File Coverage

blib/lib/Sentry/Tracing/Status.pm
Criterion Covered Total %
statement 32 57 56.1
branch 5 6 83.3
condition 2 3 66.6
subroutine 8 21 38.1
pod 0 18 0.0
total 47 105 44.7


line stmt bran cond sub pod time code
1             use Mojo::Base -base, -signatures;
2 8     8   182609  
  8         26  
  8         57  
3             use experimental qw(switch);
4 8     8   1874 use HTTP::Status qw(:constants);
  8         19  
  8         26  
5 8     8   448  
  8         20  
  8         7959  
6             # The operation completed successfully.
7              
8 9     9 0 37 # Deadline expired before operation could complete.
9              
10             # 401 Unauthorized (actually does mean unauthenticated according to RFC 7235)
11 0     0 0 0  
12             # 403 Forbidden
13              
14 0     0 0 0 # 404 Not Found. Some requested entity (file or directory) was not found.
15              
16             # 429 Too Many Requests
17 0     0 0 0  
18             # Client specified an invalid argument. 4xx.
19              
20 1     1 0 7 # 501 Not Implemented
21              
22             # 503 Service Unavailable
23 0     0 0 0  
24             # Other/generic 5xx.
25              
26 0     0 0 0 # Unknown. Any non-standard HTTP status code.
27              
28             # The operation was cancelled (typically by the user).
29 0     0 0 0  
30             # Already exists (409)
31              
32 1     1 0 4 # Operation was rejected because the system is not in a state required for the operation's
33              
34             # The operation was aborted, typically due to a concurrency issue.
35 1     1 0 4  
36             # Operation was attempted past the valid range.
37              
38 0     0 0 0 # Unrecoverable data loss or corruption
39              
40             return Sentry::Tracing::Status->Ok if $code < HTTP_BAD_REQUEST;
41 0     0 0 0  
42             if ($code >= HTTP_BAD_REQUEST && $code < HTTP_INTERNAL_SERVER_ERROR) {
43             given ($code) {
44 0     0 0 0 when (HTTP_UNAUTHORIZED) { return Unauthenticated() }
45             when (HTTP_FORBIDDEN) { return PermissionDenied() }
46             when (HTTP_NOT_FOUND) { return NotFound() }
47 0     0 0 0 when (HTTP_CONFLICT) { return AlreadyExists() }
48             when (HTTP_PRECONDITION_FAILED) { return FailedPrecondition() }
49             when (HTTP_TOO_MANY_REQUESTS) { return ResourceExhausted() }
50 0     0 0 0 default { return InvalidArgument() }
51             }
52             }
53 0     0 0 0  
54             if ($code >= HTTP_INTERNAL_SERVER_ERROR) {
55             given ($code) {
56 0     0 0 0 when (HTTP_NOT_IMPLEMENTED) { return Unimplemented() }
57             when (HTTP_SERVICE_UNAVAILABLE) { return Unavailable() }
58 12     12 0 93 when (HTTP_GATEWAY_TIMEOUT) { return DeadlineExceeded() }
  12         21  
  12         16  
  12         19  
59 12 100       57 default { return InternalError() }
60             }
61 3 100 66     17 }
62 1         2 }
63 1         3  
  0         0  
64 1         2 1;
  0         0