File Coverage

lib/Google/Ads/AdWords/Utilities/BatchJobHandlerError.pm
Criterion Covered Total %
statement 21 24 87.5
branch n/a
condition n/a
subroutine 7 9 77.7
pod 0 2 0.0
total 28 35 80.0


line stmt bran cond sub pod time code
1             # Copyright 2015, Google Inc. All Rights Reserved.
2             #
3             # Licensed under the Apache License, Version 2.0 (the "License");
4             # you may not use this file except in compliance with the License.
5             # You may obtain a copy of the License at
6             #
7             # http://www.apache.org/licenses/LICENSE-2.0
8             #
9             # Unless required by applicable law or agreed to in writing, software
10             # distributed under the License is distributed on an "AS IS" BASIS,
11             # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12             # See the License for the specific language governing permissions and
13             # limitations under the License.
14              
15             package Google::Ads::AdWords::Utilities::BatchJobHandlerError;
16              
17 2     2   2240 use strict;
  2         4  
  2         67  
18 2     2   15 use warnings;
  2         7  
  2         56  
19 2     2   10 use version;
  2         4  
  2         14  
20              
21             # The following needs to be on one line because CPAN uses a particularly hacky
22             # eval() to determine module versions.
23 2     2   116 use Google::Ads::Common::Constants; our $VERSION = ${Google::Ads::Common::Constants::VERSION};
  2         4  
  2         72  
24              
25 2     2   11 use Class::Std::Fast;
  2         5  
  2         27  
26              
27             # Error type.
28             my %type_of : ATTR(:name :default<"">);
29              
30             # Description of the error.
31             my %description_of : ATTR(:name :default<"">);
32              
33             ##################################################
34             # Additional information for HTTP errors.
35             ##################################################
36             my %http_type_of : ATTR(:name :default<"">);
37              
38             # Bad data triggering the error.
39             my %http_trigger_of : ATTR(:name :default<"">);
40              
41             # ONGL path to the field cause of the error.
42             my %http_field_path_of : ATTR(:name :default<"">);
43              
44             my %http_response_code_of : ATTR(:name :default<"">);
45              
46             my %http_response_message_of : ATTR(:name :default<"">);
47              
48             ##################################################
49             # Additional information for PROCESSING errors.
50             ##################################################
51             my %processing_errors_of : ATTR(:name :default<>);
52              
53             # Always return false in boolean context.
54             sub as_bool : BOOLIFY {
55 0     0 0 0 return;
56 2     2   369 }
  2         5  
  2         12  
57              
58             sub as_str : STRINGIFY {
59 0     0 0   my ($self) = @_;
60 0           return sprintf(
61             "BatchJobHandlerError {\n type: %s\n description: %s\n" .
62             " http_type: %s\n http_trigger: %s\n http_field_path: %s\n" .
63             " http_response_code: %s\n http_response_message: %s\n}",
64             $self->get_type(), $self->get_description(),
65             $self->get_http_type(),
66             $self->get_http_trigger(),
67             $self->get_http_field_path(),
68             $self->get_http_response_code(),
69             $self->get_http_response_message());
70 2     2   529 }
  2         4  
  2         15  
71              
72             return 1;
73              
74             =pod
75              
76             =head1 NAME
77              
78             Google::Ads::AdWords::Utilities::BatchJobHandlerError
79              
80             =head1 DESCRIPTION
81              
82             Data object that holds the information of an error that occurred during a
83             batch job upload request.
84              
85             =head1 ATTRIBUTES
86              
87             There is a get_ and set_ method associated with each attribute for retrieving or
88             setting them dynamically.
89              
90             =head2 type
91              
92             The type of error that occurred (HTTP, PROCESSING, UPLOAD).
93             HTTP => Specific to an HTTP request made to the server.
94             PROCESSING => Check the current job because the job has processing errors.
95             UPLOAD => A general error happened during upload.
96              
97             =head2 description
98              
99             The detailed description of the error.
100              
101             =head2 http_type
102              
103             For HTTP errors, the type of HTTP error.
104              
105             =head2 http_trigger
106              
107             For HTTP errors, invalid data cause of the error.
108              
109             =head2 http_field_path
110              
111             For HTTP errors, ONGL path to the field that caused the error.
112              
113             =head2 http_response_code
114              
115             For HTTP errors, the HTTP response code.
116              
117             =head2 http_response_message
118              
119             For HTTP errors, the HTTP response message.
120              
121             =head2 processing_errors
122              
123             For PROCESSING errors, this contains an array of processing errors of type
124             BatchJobProcessingError.
125              
126             =head1 LICENSE AND COPYRIGHT
127              
128             Copyright 2015 Google Inc.
129              
130             Licensed under the Apache License, Version 2.0 (the "License");
131             you may not use this file except in compliance with the License.
132             You may obtain a copy of the License at
133              
134             http://www.apache.org/licenses/LICENSE-2.0
135              
136             Unless required by applicable law or agreed to in writing, software
137             distributed under the License is distributed on an "AS IS" BASIS,
138             WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139             See the License for the specific language governing permissions and
140             limitations under the License.
141              
142             =head1 REPOSITORY INFORMATION
143              
144             $Rev: $
145             $LastChangedBy: $
146             $Id: $
147              
148             =cut
149