| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WG::API::Error; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 7 |  |  | 7 |  | 112825 | use Moo; | 
|  | 7 |  |  |  |  | 11290 |  | 
|  | 7 |  |  |  |  | 38 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | WG::API::Error - Module for work with API errors | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 VERSION | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | Version v0.13 | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =cut | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = 'v0.13'; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | Return full error data for unsuccessed requests. | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | use WG::API::Error; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | my $wg_error = WG::API::Error->new({code => 999, message => 'test error', fieald => 'unknown', value => 'none'}); | 
| 24 |  |  |  |  |  |  | ... | 
| 25 |  |  |  |  |  |  | say $wg_error->code; | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head1 CONSTRUCTOR | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =head2 new | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | Create new error object. | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =cut | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | =head2 ATTRIBUTES | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =over 1 | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =item I<code> | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | Error code. | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =back | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =cut | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | has code => ( | 
| 49 |  |  |  |  |  |  | is       => 'ro', | 
| 50 |  |  |  |  |  |  | required => 1, | 
| 51 |  |  |  |  |  |  | ); | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =over 1 | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =item I<message> | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | Error message. | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =back | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =cut | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | has message => ( | 
| 64 |  |  |  |  |  |  | is       => 'ro', | 
| 65 |  |  |  |  |  |  | required => 1, | 
| 66 |  |  |  |  |  |  | ); | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =over 1 | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =item I<field> | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | Error field. | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =back | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =cut | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | has field => ( | 
| 79 |  |  |  |  |  |  | is       => 'ro', | 
| 80 |  |  |  |  |  |  | required => 1, | 
| 81 |  |  |  |  |  |  | ); | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =over 1 | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =item I<value> | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | Error value. | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =back | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =cut | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | has value => ( | 
| 94 |  |  |  |  |  |  | is       => 'ro', | 
| 95 |  |  |  |  |  |  | required => 1, | 
| 96 |  |  |  |  |  |  | ); | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =over | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =item I<raw> | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | RAW data from invalid response | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =back | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =cut | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | has raw => ( is => 'ro', ); | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =head1 BUGS | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | Please report any bugs or feature requests to C<cynovg at cpan.org>, or through the web interface at L<https://gitlab.com/cynovg/WG-API/issues>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head1 SUPPORT | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | perldoc WG::API | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | You can also look for information at: | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =over 4 | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =item * RT: Gitlab's request tracker (report bugs here) | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | L<https://gitlab.com/cynovg/WG-API/issues> | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | L<http://annocpan.org/dist/WG-API> | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | L<http://cpanratings.perl.org/d/WG-API> | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =item * Search CPAN | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | L<https://metacpan.org/pod/WG::API> | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =back | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | ... | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | WG API Reference L<https://developers.wargaming.net/> | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =head1 AUTHOR | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | Cyrill Novgorodcev , C<< <cynovg at cpan.org> >> | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | Copyright 2015 Cyrill Novgorodcev. | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 160 |  |  |  |  |  |  | under the terms of the the Artistic License (2.0). You may obtain a | 
| 161 |  |  |  |  |  |  | copy of the full license at: | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | L<http://www.perlfoundation.org/artistic_license_2_0> | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | Any use, modification, and distribution of the Standard or Modified | 
| 166 |  |  |  |  |  |  | Versions is governed by this Artistic License. By using, modifying or | 
| 167 |  |  |  |  |  |  | distributing the Package, you accept this license. Do not use, modify, | 
| 168 |  |  |  |  |  |  | or distribute the Package, if you do not accept this license. | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | If your Modified Version has been derived from a Modified Version made | 
| 171 |  |  |  |  |  |  | by someone other than you, you are nevertheless required to ensure that | 
| 172 |  |  |  |  |  |  | your Modified Version complies with the requirements of this license. | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | This license does not grant you the right to use any trademark, service | 
| 175 |  |  |  |  |  |  | mark, tradename, or logo of the Copyright Holder. | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | This license includes the non-exclusive, worldwide, free-of-charge | 
| 178 |  |  |  |  |  |  | patent license to make, have made, use, offer to sell, sell, import and | 
| 179 |  |  |  |  |  |  | otherwise transfer the Package with respect to any patent claims | 
| 180 |  |  |  |  |  |  | licensable by the Copyright Holder that are necessarily infringed by the | 
| 181 |  |  |  |  |  |  | Package. If you institute patent litigation (including a cross-claim or | 
| 182 |  |  |  |  |  |  | counterclaim) against any party alleging that the Package constitutes | 
| 183 |  |  |  |  |  |  | direct or contributory patent infringement, then this Artistic License | 
| 184 |  |  |  |  |  |  | to you shall terminate on the date that such litigation is filed. | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | 
| 187 |  |  |  |  |  |  | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | 
| 188 |  |  |  |  |  |  | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | 
| 189 |  |  |  |  |  |  | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | 
| 190 |  |  |  |  |  |  | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | 
| 191 |  |  |  |  |  |  | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | 
| 192 |  |  |  |  |  |  | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | 
| 193 |  |  |  |  |  |  | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 194 |  |  |  |  |  |  |  | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | =cut | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | 1;    # End of WG::API::Error |