blib/lib/Sentry/Tracing/Status.pm

filter: Statementstmt 46.3% 25 / 54 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 33.3% 7 / 21 Podpod 0.0% 0 / 18 totaltotal 38.4% 40 / 104 CC 5 SCAR 10.6
CC
5
Cov
51%
from_http_code
7.6
DeadlineExceeded
2.0
Unauthenticated
2.0
CRAP 2.9
« blib/lib/Sentry/SourceFileRegistry.pm ↑ Summary blib/lib/Sentry/Hub.pm »
1 package Sentry::Tracing::Status;
2 1 ▶use Mojo::Base -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use experimental qw(switch);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use HTTP::Status qw(:constants);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # The operation completed successfully.
8 1 ▶sub Ok {'ok'}
Subroutine Ok: called CC=1 SCAR=0.0
Pod undocumented
9  
10 # Deadline expired before operation could complete.
11 0 ▶sub DeadlineExceeded {'deadline_exceeded'}
Subroutine DeadlineExceeded: not called CC=1 SCAR=6.9
Pod undocumented
12  
13 # 401 Unauthorized (actually does mean unauthenticated according to RFC 7235)
14 0 ▶sub Unauthenticated {'unauthenticated'}
Subroutine Unauthenticated: not called CC=1 SCAR=6.9
Pod undocumented
15  
16 # 403 Forbidden
17 0 ▶sub PermissionDenied {'permission_denied'}
Subroutine PermissionDenied: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 # 404 Not Found. Some requested entity (file or directory) was not found.
20 1 ▶sub NotFound {'not_found'}
Subroutine NotFound: called CC=1 SCAR=0.0
Pod undocumented
21  
22 # 429 Too Many Requests
23 0 ▶sub ResourceExhausted {'resource_exhausted'}
Subroutine ResourceExhausted: not called CC=1 SCAR=6.9
Pod undocumented
24  
25 # Client specified an invalid argument. 4xx.
26 0 ▶sub InvalidArgument {'invalid_argument'}
Subroutine InvalidArgument: not called CC=1 SCAR=6.9
Pod undocumented
27  
28 # 501 Not Implemented
29 0 ▶sub Unimplemented {'unimplemented'}
Subroutine Unimplemented: not called CC=1 SCAR=6.9
Pod undocumented
30  
31 # 503 Service Unavailable
32 1 ▶sub Unavailable {'unavailable'}
Subroutine Unavailable: called CC=1 SCAR=0.0
Pod undocumented
33  
34 # Other/generic 5xx.
35 0 ▶sub InternalError {'internal_error'}
Subroutine InternalError: not called CC=1 SCAR=6.9
Pod undocumented
36  
37 # Unknown. Any non-standard HTTP status code.
38 0 ▶sub UnknownError {'unknown_error'}
Subroutine UnknownError: not called CC=1 SCAR=6.9
Pod undocumented
39  
40 # The operation was cancelled (typically by the user).
41 0 ▶sub Cancelled {'cancelled'}
Subroutine Cancelled: not called CC=1 SCAR=6.9
Pod undocumented
42  
43 # Already exists (409)
44 0 ▶sub AlreadyExists {'already_exists'}
Subroutine AlreadyExists: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 # Operation was rejected because the system is not in a state required for the operation's
47 0 ▶sub FailedPrecondition {'failed_precondition'}
Subroutine FailedPrecondition: not called CC=1 SCAR=6.9
Pod undocumented
48  
49 # The operation was aborted, typically due to a concurrency issue.
50 0 ▶sub Aborted {'aborted'}
Subroutine Aborted: not called CC=1 SCAR=6.9
Pod undocumented
51  
52 # Operation was attempted past the valid range.
53 0 ▶sub OutOfRange {'out_of_range'}
Subroutine OutOfRange: not called CC=1 SCAR=6.9
Pod undocumented
54  
55 # Unrecoverable data loss or corruption
56 0 ▶sub DataLoss {'data_loss'}
Subroutine DataLoss: not called CC=1 SCAR=6.9
Pod undocumented
57  
58 ▶sub from_http_code ($package, $code) {
Subroutine from_http_code: called CC=5 SCAR=20.3
Pod undocumented
59 3 ▶ return Sentry::Tracing::Status->Ok if $code < HTTP_BAD_REQUEST;
Branch: 1 branch
BranchTrueFalseTotal
if $code < 400 1 2 3
60  
61 2 ▶ if ($code >= HTTP_BAD_REQUEST && $code < HTTP_INTERNAL_SERVER_ERROR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code >= 400 and $code < 500) 1 1 2
Condition66%2/3
$code >= 400 and $code < 500
!ll&&!rl&&r
011
MC/DC50%1/2
$code >= 400 and $code < 500
$code >= 400 $code < 500
Truth table66%2/3
A and B
A= $code >= 400B= $code < 500
ABresult
0X0
100
111
62 1 given ($code) {
63 1 when (HTTP_UNAUTHORIZED) { return Unauthenticated() }
64 1 when (HTTP_FORBIDDEN) { return PermissionDenied() }
65 1 when (HTTP_NOT_FOUND) { return NotFound() }
66 0 when (HTTP_CONFLICT) { return AlreadyExists() }
67 0 when (HTTP_PRECONDITION_FAILED) { return FailedPrecondition() }
68 0 when (HTTP_TOO_MANY_REQUESTS) { return ResourceExhausted() }
69 0 default { return InvalidArgument() }
70 }
71 }
72  
73 1 ▶ if ($code >= HTTP_INTERNAL_SERVER_ERROR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code >= 500) 1 0 1
74 1 given ($code) {
75 1 when (HTTP_NOT_IMPLEMENTED) { return Unimplemented() }
76 1 when (HTTP_SERVICE_UNAVAILABLE) { return Unavailable() }
77 0 when (HTTP_GATEWAY_TIMEOUT) { return DeadlineExceeded() }
78 0 default { return InternalError() }
79 }
80 }
81 }
82  
83 1 1;
« blib/lib/Sentry/SourceFileRegistry.pm ↑ Summary blib/lib/Sentry/Hub.pm »