File: Error.pm

package info (click to toggle)
libcatmandu-perl 0.9206-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,768 kB
  • ctags: 512
  • sloc: perl: 7,798; makefile: 34
file content (84 lines) | stat: -rw-r--r-- 1,476 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package Catmandu::Error;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Throwable::Error';

package Catmandu::BadVal;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::Error';

package Catmandu::BadArg;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::BadVal';

package Catmandu::NotImplemented;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::Error';

package Catmandu::NoSuchPackage;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::Error';

package Catmandu::ParseError;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::Error';

has source => (is => 'ro');

package Catmandu::FixError;
use namespace::clean;
use Catmandu::Sane;
use Moo;
extends 'Catmandu::Error';

has data   => (is => 'ro');
has fix    => (is => 'ro');

=head1 NAME

Catmandu::Error - Catmandu error hierarchy

=head1 SYNOPSIS

    use Catmandu::Sane;

    sub be_naughty {
        Catmandu::BadArg->throw("very naughty") if shift;
    }

    try {
        be_naughty(1);
    } catch_case [
        'Catmandu::BadArg' => sub {
            say "sorry";
        }
    ];

=head1 CURRRENT ERROR HIERARCHY
    Throwable::Error
        Catmandu::Error
            Catmandu::BadVal
                Catmandu::BadArg
            Catmandu::NotImplemented
            Catmandu::NoSuchPackage
            Catmandu::ParseError
            Catmandu::FixError

=head1 SEE ALSO

L<Throwable>

=cut

1;