-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathHttpApiError.php
More file actions
44 lines (37 loc) · 930 Bytes
/
HttpApiError.php
File metadata and controls
44 lines (37 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Seam;
class HttpApiError extends \Exception
{
private string $errorCode;
private int $statusCode;
private string $requestId;
private ?object $data = null;
public function __construct(
object $error,
int $statusCode,
string $requestId,
) {
$message = $error->message ?? "Unknown error";
parent::__construct($message);
$this->errorCode = $error->type ?? "unknown";
$this->statusCode = $statusCode;
$this->requestId = $requestId;
$this->data = $error->data ?? null;
}
public function getErrorCode(): string
{
return $this->errorCode;
}
public function getStatusCode(): int
{
return $this->statusCode;
}
public function getRequestId(): string
{
return $this->requestId;
}
public function getData(): mixed
{
return $this->data;
}
}