• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tylernathanreed / jira-client-php / 14523164870

17 Apr 2025 07:18PM UTC coverage: 81.598% (-0.05%) from 81.645%
14523164870

push

github

tylernathanreed
~ More explicit exceptions

0 of 17 new or added lines in 2 files covered. (0.0%)

5738 of 7032 relevant lines covered (81.6%)

10.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Http/Exceptions/HttpException.php
1
<?php
2

3
namespace Jira\Client\Http\Exceptions;
4

5
use Jira\Client\Http\Response;
6
use RuntimeException;
7
use Throwable;
8

9
class HttpException extends RuntimeException
10
{
11
    public Response $response;
12

13
    private const PHRASES = [
14
        100 => 'Continue',
15
        101 => 'Switching Protocols',
16
        102 => 'Processing',
17
        200 => 'OK',
18
        201 => 'Created',
19
        202 => 'Accepted',
20
        203 => 'Non-Authoritative Information',
21
        204 => 'No Content',
22
        205 => 'Reset Content',
23
        206 => 'Partial Content',
24
        207 => 'Multi-status',
25
        208 => 'Already Reported',
26
        300 => 'Multiple Choices',
27
        301 => 'Moved Permanently',
28
        302 => 'Found',
29
        303 => 'See Other',
30
        304 => 'Not Modified',
31
        305 => 'Use Proxy',
32
        306 => 'Switch Proxy',
33
        307 => 'Temporary Redirect',
34
        308 => 'Permanent Redirect',
35
        400 => 'Bad Request',
36
        401 => 'Unauthorized',
37
        402 => 'Payment Required',
38
        403 => 'Forbidden',
39
        404 => 'Not Found',
40
        405 => 'Method Not Allowed',
41
        406 => 'Not Acceptable',
42
        407 => 'Proxy Authentication Required',
43
        408 => 'Request Time-out',
44
        409 => 'Conflict',
45
        410 => 'Gone',
46
        411 => 'Length Required',
47
        412 => 'Precondition Failed',
48
        413 => 'Request Entity Too Large',
49
        414 => 'Request-URI Too Large',
50
        415 => 'Unsupported Media Type',
51
        416 => 'Requested range not satisfiable',
52
        417 => 'Expectation Failed',
53
        418 => 'I\'m a teapot',
54
        422 => 'Unprocessable Entity',
55
        423 => 'Locked',
56
        424 => 'Failed Dependency',
57
        425 => 'Unordered Collection',
58
        426 => 'Upgrade Required',
59
        428 => 'Precondition Required',
60
        429 => 'Too Many Requests',
61
        431 => 'Request Header Fields Too Large',
62
        451 => 'Unavailable For Legal Reasons',
63
        500 => 'Internal Server Error',
64
        501 => 'Not Implemented',
65
        502 => 'Bad Gateway',
66
        503 => 'Service Unavailable',
67
        504 => 'Gateway Time-out',
68
        505 => 'HTTP Version not supported',
69
        506 => 'Variant Also Negotiates',
70
        507 => 'Insufficient Storage',
71
        508 => 'Loop Detected',
72
        510 => 'Not Extended',
73
        511 => 'Network Authentication Required',
74
    ];
75

NEW
76
    public function __construct(
×
77
        Response $response,
78
        ?string $message = null,
79
        ?Throwable $previous = null,
80
    ) {
NEW
81
        $this->response = $response;
×
82

NEW
83
        $reason = self::PHRASES[$response->status] ?? 'Http Exception';
×
84

NEW
85
        parent::__construct(
×
NEW
86
            message: "[{$response->status}] {$reason}" . ($message ? ": {$message}" : ''),
×
NEW
87
            code: $response->status,
×
NEW
88
            previous: $previous,
×
NEW
89
        );
×
90
    }
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc