File Coverage

blib/lib/Net/Stomp/MooseHelpers/Exceptions.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Net::Stomp::MooseHelpers::Exceptions;
2             $Net::Stomp::MooseHelpers::Exceptions::VERSION = '3.0';
3             {
4             $Net::Stomp::MooseHelpers::Exceptions::DIST = 'Net-Stomp-MooseHelpers';
5             }
6             # ABSTRACT: exception classes for Net::Stomp::MooseHelpers
7              
8              
9             {
10             package Net::Stomp::MooseHelpers::Exceptions::Stringy;
11             $Net::Stomp::MooseHelpers::Exceptions::Stringy::VERSION = '3.0';
12             {
13             $Net::Stomp::MooseHelpers::Exceptions::Stringy::DIST = 'Net-Stomp-MooseHelpers';
14             }
15 3     3   18 use Moose::Role;
  3         7  
  3         19  
16 3     3   14140 use MooseX::Role::WithOverloading;
  3         300803  
  3         12  
17             use overload
18 3         25 q{""} => 'as_string',
19 3     3   6159 fallback => 1;
  3         7  
20             requires 'as_string';
21             }
22             {
23             package Net::Stomp::MooseHelpers::Exceptions::Stomp;
24             $Net::Stomp::MooseHelpers::Exceptions::Stomp::VERSION = '3.0';
25             {
26             $Net::Stomp::MooseHelpers::Exceptions::Stomp::DIST = 'Net-Stomp-MooseHelpers';
27             }
28 3     3   327 use Moose;with 'Throwable','Net::Stomp::MooseHelpers::Exceptions::Stringy';
  3         7  
  3         15  
29 3     3   17770 use namespace::autoclean;
  3         7  
  3         16  
30             has '+previous_exception' => (
31             init_arg => 'stomp_error',
32             );
33             sub as_string {
34 8     8 0 278 return 'STOMP protocol/network error:'.$_[0]->previous_exception;
35             }
36             __PACKAGE__->meta->make_immutable;
37             }
38              
39             1;
40              
41             __END__
42              
43             =pod
44              
45             =encoding UTF-8
46              
47             =head1 NAME
48              
49             Net::Stomp::MooseHelpers::Exceptions - exception classes for Net::Stomp::MooseHelpers
50              
51             =head1 VERSION
52              
53             version 3.0
54              
55             =head1 DESCRIPTION
56              
57             This file defines the following exception classes:
58              
59             =over 4
60              
61             =item C<Net::Stomp::MooseHelpers::Exceptions::Stringy>
62              
63             Exception I<role> to overload stringification delegating it to a
64             C<as_string> method.
65              
66             =item C<Net::Stomp::MooseHelpers::Exceptions::Stomp>
67              
68             Thrown whenever the STOMP library (usually L<Net::Stomp>) dies; has a
69             C<previous_exception> attribute containing the exception that the
70             library threw.
71              
72             =back
73              
74             =head1 AUTHOR
75              
76             Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
77              
78             =head1 COPYRIGHT AND LICENSE
79              
80             This software is copyright (c) 2014 by Net-a-porter.com.
81              
82             This is free software; you can redistribute it and/or modify it under
83             the same terms as the Perl 5 programming language system itself.
84              
85             =cut