Mattermost/Role/Returns.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 11 / 11 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
error_return
1.0
CRAP 1.0
« Mattermost/Role/Logger.pm ↑ Summary Mattermost/Role/UserAgent.pm »
1 package WebService::Mattermost::Role::Returns;
2  
3 # ABSTRACT: Standard returns for user-facing subroutines.
4  
5 14 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 ################################################################################
8  
9 sub error_return {
10 4 ▶ my $self = shift;
Subroutine error_return: called CC=1 SCAR=0.0
Pod documented
11 4 my $error = shift;
12  
13 4 $error = sprintf '%s. No API query was made.', $error;
14  
15 4 return { error => 1, message => $error };
16 }
17  
18 ################################################################################
19  
20 14 1;
21  
22 __END__
23  
24 =pod
25  
26 =encoding UTF-8
27  
28 =head1 NAME
29  
30 WebService::Mattermost::Role::Returns - Standard returns for user-facing subroutines.
31  
32 =head1 VERSION
33  
34 version 0.28
35  
36 =head1 DESCRIPTION
37  
38 Common structures for return values.
39  
40 =head2 METHODS
41  
42 =over 4
43  
44 =item C<error_return()>
45  
46 Return an unsuccessful response with an error message.
47  
48 return $self->error_return('Error here');
49  
50 # \{
51 # error => 1,
52 # message => 'Error here. No API query was made.',
53 # }
54  
55 =back
56  
57 =head1 AUTHOR
58  
59 Mike Jones <mike@netsplit.org.uk>
60  
61 =head1 COPYRIGHT AND LICENSE
62  
63 This software is Copyright (c) 2020 by Mike Jones.
64  
65 This is free software, licensed under:
66  
67 The MIT (X11) License
68  
69 =cut
« Mattermost/Role/Logger.pm ↑ Summary Mattermost/Role/UserAgent.pm »