| 1 | use 5.006; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package Net::API::RPX::Exception::Service; | ||
| 6 | |||
| 7 | # ABSTRACT: A Class of exceptions for delivering problems from the RPX service. | ||
| 8 | |||
| 9 | our $VERSION = '1.000000'; | ||
| 10 | |||
| 11 | our $AUTHORITY = 'cpan:KONOBI'; # AUTHORITY | ||
| 12 | |||
| 13 | use Moose qw( has extends ); | ||
| 14 | use namespace::autoclean; | ||
| 15 | |||
| 16 | extends 'Net::API::RPX::Exception'; | ||
| 17 | |||
| 18 | my $rpx_errors = { | ||
| 19 | -1 => 'Service Temporarily Unavailable', | ||
| 20 | 0 => 'Missing parameter', | ||
| 21 | 1 => 'Invalid parameter', | ||
| 22 | 2 => 'Data not found', | ||
| 23 | 3 => 'Authentication error', | ||
| 24 | 4 => 'Facebook Error', | ||
| 25 | 5 => 'Mapping exists', | ||
| 26 | }; | ||
| 27 | |||
| 28 | has 'data' => ( isa => 'Any', is => 'ro', required => 1 ); | ||
| 29 | has 'status' => ( isa => 'Any', is => 'ro', required => 1 ); | ||
| 30 | has 'rpx_error' => ( isa => 'Any', is => 'ro', required => 1 ); | ||
| 31 | has 'rpx_error_code' => ( isa => 'Any', is => 'ro', required => 1 ); | ||
| 32 | has 'rpx_error_message' => ( isa => 'Any', is => 'ro', required => 1 ); | ||
| 33 | has | ||
| 34 | 'rpx_error_code_description' => ( isa => 'Any', is => 'ro', required => 1, lazy => 1, ), | ||
| 35 | , builder => '_build_rpx_error_code_description'; | ||
| 36 | |||
| 37 | __PACKAGE__->meta->make_immutable( inline_constructor => 0 ); | ||
| 38 | no Moose; | ||
| 39 | |||
| 40 | sub _build_rpx_error_code_description { | ||
| 41 | my ($self) = shift; | ||
| 42 | return $rpx_errors->{ $self->rpx_error_code }; | ||
| 43 | } | ||
| 44 | 1; | ||
| 45 | |||
| 46 | __END__ | ||
| 47 | |||
| 48 | =pod | ||
| 49 | |||
| 50 | =encoding UTF-8 | ||
| 51 | |||
| 52 | =head1 NAME | ||
| 53 | |||
| 54 | Net::API::RPX::Exception::Service - A Class of exceptions for delivering problems from the RPX service. | ||
| 55 | |||
| 56 | =head1 VERSION | ||
| 57 | |||
| 58 | version 1.000000 | ||
| 59 | |||
| 60 | =head1 AUTHORS | ||
| 61 | |||
| 62 | =over 4 | ||
| 63 | |||
| 64 | =item * | ||
| 65 | |||
| 66 | Scott McWhirter <konobi@cpan.org> | ||
| 67 | |||
| 68 | =item * | ||
| 69 | |||
| 70 | Kent Fredric <kentnl@cpan.org> | ||
| 71 | |||
| 72 | =back | ||
| 73 | |||
| 74 | =head1 COPYRIGHT AND LICENSE | ||
| 75 | |||
| 76 | This software is Copyright (c) 2015 by Cloudtone Studios. | ||
| 77 | |||
| 78 | This is free software, licensed under: | ||
| 79 | |||
| 80 | The (three-clause) BSD License | ||
| 81 | |||
| 82 | =cut |