« blib/lib/auto/share/dist/Beekeeper/websocket/lib/MyApp/Service/Calculator.pm
↑ Summary
lib/Beekeeper/JSONRPC/Notification.pm »
| 1 | package Beekeeper::JSONRPC::Error; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | 11 | our $VERSION = '0.10'; | |||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | |||||||||||||||||||||||
| 9 | 0 | ▶ | use overload '""' => sub { $_[0]->{error}->{message} }; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | 2 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||
| 12 | 2 | my ($class, %args) = @_; | |||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | bless { | ||||||||||||||||||||||
| 15 | jsonrpc => '2.0', | ||||||||||||||||||||||
| 16 | id => undef, | ||||||||||||||||||||||
| 17 | error => { | ||||||||||||||||||||||
| 18 | code => $args{code} || -32603, | ||||||||||||||||||||||
| 19 | message => $args{message} || "Internal error", | ||||||||||||||||||||||
| 20 | data => $args{data}, | ||||||||||||||||||||||
| 21 | }, | ||||||||||||||||||||||
| 22 | 2 | ▶ | }, $class; | ||||||||||||||||||||
|
Condition50%2/4
$args{'code'} || -32603
$args{'message'} || 'Internal error'
MC/DC0%0/1
$args{'code'} || -32603
$args{'code'}
MC/DC0%0/1
$args{'message'} || 'Internal error'
$args{'message'}
Truth table50%1/2
A
A= $args{'code'}
Truth table50%1/2
A
A= $args{'message'}
| |||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||
| 24 | |||||||||||||||||||||||
| 25 | 0 | ▶ | sub id { $_[0]->{id} } | ||||||||||||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 26 | 7 | ▶ | sub message { $_[0]->{error}->{message} } | ||||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 27 | 7 | ▶ | sub code { $_[0]->{error}->{code} } | ||||||||||||||||||||
|
Subroutine
code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 28 | 1 | ▶ | sub data { $_[0]->{error}->{data} } | ||||||||||||||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 29 | |||||||||||||||||||||||
| 30 | 2 | ▶ | sub success { 0 } | ||||||||||||||||||||
|
Subroutine
success: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 31 | |||||||||||||||||||||||
| 32 | 0 | ▶ | sub TO_JSON { return { %{$_[0]} } } | ||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 33 | |||||||||||||||||||||||
| 34 | |||||||||||||||||||||||
| 35 | 0 | ▶ | sub parse_error { | ||||||||||||||||||||
|
Subroutine
parse_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 36 | shift->new( | ||||||||||||||||||||||
| 37 | 0 | code => -32700, | |||||||||||||||||||||
| 38 | message => "Parse error", | ||||||||||||||||||||||
| 39 | data => "Invalid JSON was received by the server", | ||||||||||||||||||||||
| 40 | @_ | ||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | 0 | ▶ | sub invalid_request { | ||||||||||||||||||||
|
Subroutine
invalid_request: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 45 | shift->new( | ||||||||||||||||||||||
| 46 | 0 | code => -32600, | |||||||||||||||||||||
| 47 | message => "Invalid request", | ||||||||||||||||||||||
| 48 | data => "The JSON sent is not a valid request object.", | ||||||||||||||||||||||
| 49 | @_ | ||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||
| 52 | |||||||||||||||||||||||
| 53 | 2 | ▶ | sub request_timeout { | ||||||||||||||||||||
|
Subroutine
request_timeout: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 54 | shift->new( | ||||||||||||||||||||||
| 55 | 2 | code => -31600, | |||||||||||||||||||||
| 56 | message => "Request timeout", | ||||||||||||||||||||||
| 57 | @_ | ||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||
| 60 | |||||||||||||||||||||||
| 61 | 0 | ▶ | sub request_not_authenticated { | ||||||||||||||||||||
|
Subroutine
request_not_authenticated: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 62 | shift->new( | ||||||||||||||||||||||
| 63 | 0 | code => -401, | |||||||||||||||||||||
| 64 | message => "Not logged in", | ||||||||||||||||||||||
| 65 | data => "Request was not authenticated", | ||||||||||||||||||||||
| 66 | @_ | ||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||
| 69 | |||||||||||||||||||||||
| 70 | 0 | ▶ | sub request_not_authorized { | ||||||||||||||||||||
|
Subroutine
request_not_authorized: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 71 | shift->new( | ||||||||||||||||||||||
| 72 | 0 | code => -403, | |||||||||||||||||||||
| 73 | message => "Request not authorized", | ||||||||||||||||||||||
| 74 | data => "Request was not authorized", | ||||||||||||||||||||||
| 75 | @_ | ||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||
| 78 | |||||||||||||||||||||||
| 79 | 0 | ▶ | sub method_not_found { | ||||||||||||||||||||
|
Subroutine
method_not_found: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 80 | shift->new( | ||||||||||||||||||||||
| 81 | 0 | code => -32601, | |||||||||||||||||||||
| 82 | message => "Method not found", | ||||||||||||||||||||||
| 83 | data => "The method does not exist", | ||||||||||||||||||||||
| 84 | @_ | ||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||
| 87 | |||||||||||||||||||||||
| 88 | 0 | ▶ | sub method_not_available { | ||||||||||||||||||||
|
Subroutine
method_not_available: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 89 | shift->new( | ||||||||||||||||||||||
| 90 | 0 | code => -31601, | |||||||||||||||||||||
| 91 | message => "Method not available", | ||||||||||||||||||||||
| 92 | data => "The method is not available.", | ||||||||||||||||||||||
| 93 | @_ | ||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||
| 96 | |||||||||||||||||||||||
| 97 | 0 | ▶ | sub invalid_params { | ||||||||||||||||||||
|
Subroutine
invalid_params: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 98 | shift->new( | ||||||||||||||||||||||
| 99 | 0 | code => -32602, | |||||||||||||||||||||
| 100 | message => "Invalid params", | ||||||||||||||||||||||
| 101 | data => "Invalid method parameters.", | ||||||||||||||||||||||
| 102 | @_ | ||||||||||||||||||||||
| 103 | ); | ||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||
| 105 | |||||||||||||||||||||||
| 106 | 0 | ▶ | sub internal_error { | ||||||||||||||||||||
|
Subroutine
internal_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 107 | shift->new( | ||||||||||||||||||||||
| 108 | 0 | code => -32603, | |||||||||||||||||||||
| 109 | message => "Internal error", | ||||||||||||||||||||||
| 110 | data => "Internal JSON-RPC error.", | ||||||||||||||||||||||
| 111 | @_ | ||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||
| 114 | |||||||||||||||||||||||
| 115 | 0 | ▶ | sub server_error { | ||||||||||||||||||||
|
Subroutine
server_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 116 | shift->new( | ||||||||||||||||||||||
| 117 | 0 | code => -32000, | |||||||||||||||||||||
| 118 | message => "Server error", | ||||||||||||||||||||||
| 119 | @_ | ||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||
| 122 | |||||||||||||||||||||||
| 123 | 11 | 1; | |||||||||||||||||||||
| 124 | |||||||||||||||||||||||
| 125 | __END__ | ||||||||||||||||||||||