lib/Net/API/CPAN/Exception.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Net/API/CPAN/Exception.pm ↑ Summary
1 ##----------------------------------------------------------------------------
2 ## Meta CPAN API - ~/lib/Net/API/CPAN/Exception.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2023 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2023/07/26
7 ## Modified 2023/07/26
8 ## All rights reserved
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package Net::API::CPAN::Exception;
14 BEGIN
15 {
16 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use parent qw( Module::Generic::Exception );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ our $VERSION = 'v0.1.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 };
21  
22 1 1;
23 # NOTE: POD
24 __END__
25  
26 =encoding utf-8
27  
28 =head1 NAME
29  
30 Net::API::CPAN::Exception - Meta CPAN API Exception
31  
32 =head1 SYNOPSIS
33  
34 use Net::API::CPAN::Exception;
35 my $this = Net::API::CPAN::Exception->new(
36 code => 500,
37 message => $error_message,
38 );
39 die( $this );
40  
41 my $ex = Net::API::CPAN::Exception->new({
42 code => 404,
43 type => $error_type,
44 file => '/home/joe/some/lib/Net/API/CPAN/Author.pm',
45 line => 114,
46 message => 'Invalid property provided',
47 package => 'Net::API::CPAN::Author',
48 subroutine => 'cpanid',
49 # Some optional discretionary metadata hash reference
50 cause =>
51 {
52 object => $some_object,
53 payload => $json_data,
54 },
55 });
56 print( "Error stack trace: ", $ex->stack_trace, "\n" );
57 # or
58 $author->updated( $bad_datetime ) ||
59 die( "Error in file ", $author->error->file, " at line ", $author->error->line, "\n" );
60 # or simply:
61 $author->customer_orders ||
62 die( "Error: ", $author->error, "\n" );
63 $ex->cause->payload;
64  
65 =head1 VERSION
66  
67 v0.1.0
68  
69 =head1 DESCRIPTION
70  
71 This class inherits all its methods from L<Module::Generic::Exception>
72  
73 =head1 METHODS
74  
75 Plese see L<Module::Generic::Exception> for details.
76  
77 =head1 AUTHOR
78  
79 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
80  
81 =head1 SEE ALSO
82  
83 L<Module::Generic::Exception>
84  
85 =head1 COPYRIGHT & LICENSE
86  
87 Copyright(c) 2023 DEGUEST Pte. Ltd.
88  
89 All rights reserved.
90  
91 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
92  
93 =cut
« blib/lib/Net/API/CPAN/Exception.pm ↑ Summary