|
@@ -52,11 +52,11 @@ |
|
|
block discarded – undo |
|
52
|
52
|
public static function fromApiResponse(ApiResponse $api_response, ?Throwable $previous = null): AbstractApiException | Error |
|
53
|
53
|
{ |
|
54
|
54
|
return match($api_response->getStatus()) { |
|
55
|
|
- 401 => new UnauthorizedApiException(previous: $previous), |
|
56
|
|
- 403 => new InaccessibleResourceException(previous: $previous), |
|
57
|
|
- 404 => new EntityNotFoundException(previous: $previous), |
|
58
|
|
- 422 => new MalformedPayloadException(previous: $previous, errors: $api_response->getData()), |
|
59
|
|
- default => new Error(message: "Undefined error", code: 1000, previous: $previous), |
|
|
55
|
+ 401 => new UnauthorizedApiException(previous : $previous), |
|
|
56
|
+ 403 => new InaccessibleResourceException(previous : $previous), |
|
|
57
|
+ 404 => new EntityNotFoundException(previous : $previous), |
|
|
58
|
+ 422 => new MalformedPayloadException(previous : $previous, errors : $api_response->getData()), |
|
|
59
|
+ default => new Error(message : "Undefined error", code : 1000, previous : $previous), |
|
60
|
60
|
}; |
|
61
|
61
|
} |
|
62
|
62
|
} |
Please login to merge, or discard this patch.