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 9     9   186973  
  9         27  
  9         86  
3             use experimental qw(switch);
4 9     9   2503 use HTTP::Status qw(:constants);
  9         21  
  9         31  
5 9     9   543  
  9         24  
  9         9515  
6             # The operation completed successfully.
7              
8 10     10 0 41 # 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 6 # 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 5 # 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 6  
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 13     13 0 104 when (HTTP_GATEWAY_TIMEOUT) { return DeadlineExceeded() }
  13         23  
  13         21  
  13         17  
59 13 100       62 default { return InternalError() }
60             }
61 3 100 66     22 }
62 1         2 }
63 1         3  
  0         0  
64 1         2 1;
  0         0