File Coverage

blib/lib/JMAP/Tester/Result/Failure.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1 2     2   20 use v5.20.0;
  2         6  
2              
3             package JMAP::Tester::Result::Failure 0.110;
4             # ABSTRACT: what you get when your JMAP request utterly fails
5              
6 2     2   7 use Moo;
  2         2  
  2         12  
7             with 'JMAP::Tester::Role::HTTPResult';
8              
9 2     2   589 use experimental 'signatures';
  2         2  
  2         8  
10              
11 2     2   212 use Sub::Install ();
  2         37  
  2         40  
12              
13 2     2   43 use namespace::clean;
  2         66  
  2         12  
14              
15             #pod =head1 OVERVIEW
16             #pod
17             #pod This is the sort of worthless object you get back when your JMAP request fails.
18             #pod This class should be replaced, in most cases, by more useful classes in the
19             #pod future.
20             #pod
21             #pod It's got an C method. It returns false. It also has:
22             #pod
23             #pod =method ident
24             #pod
25             #pod An error identifier. May or may not be defined.
26             #pod
27             #pod =cut
28              
29 4     4 0 1855 sub is_success { 0 }
30              
31             has ident => (is => 'ro', predicate => 'has_ident');
32              
33             for my $method (qw(
34             sentence
35             sentences
36             single_sentence
37             sentence_named
38             assert_n_sentences
39             paragraph
40             paragraphs
41             assert_n_paragraphs
42             paragraph_by_client_id
43             as_triples
44             as_stripped_triples
45             as_pairs
46             as_stripped_pairs
47              
48             wrapper_properties
49             )) {
50 14         18 Sub::Install::install_sub({
51             into => __PACKAGE__,
52             as => $method,
53 14     14   61073 code => sub ($self, @) {
  14         16  
54 14         55 $self->abort("tried to call Response method $method on a Failure", [ Result => $self ]);
55             }
56             });
57             }
58              
59             1;
60              
61             __END__