You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -70,48 +75,39 @@ function send(Request $request)
70
75
71
76
switch ($response->getStatusCode()) {
72
77
case200:
73
-
return$response;
74
78
case304:
75
-
thrownewRequestNotModifiedException("Record has not been modified since the last request.", $response->getStatusCode(), null, HeaderUtil::extractEtag($response->getHeaders()));
79
+
return$response;
76
80
case400:
77
-
thrownewBadRequestException($this->messageFrom($response, "Bad Request (Malformed Payload): A GET request lacked a street field or the request body of a POST request contained malformed JSON."), $response->getStatusCode());
81
+
thrownewBadRequestException($this->messageFrom($response, "Bad Request (Malformed Payload): A GET request lacked a required field or the request body of a POST request contained malformed JSON."), $response->getStatusCode());
78
82
case401:
79
83
thrownewBadCredentialsException($this->messageFrom($response, "Unauthorized: The credentials were provided incorrectly or did not match any existing, active credentials."), $response->getStatusCode());
80
84
case402:
81
85
thrownewPaymentRequiredException($this->messageFrom($response, "Payment Required: There is no active subscription for the account associated with the credentials submitted with the request."), $response->getStatusCode());
86
+
case403:
87
+
thrownewForbiddenException($this->messageFrom($response, "Forbidden: The request contained valid data and was understood by the server, but the server is refusing action."), $response->getStatusCode());
thrownewRequestEntityTooLargeException($this->messageFrom($response, "Request Entity Too Large: The request body has exceeded the maximum size."), $response->getStatusCode());
thrownewTooManyRequestsException("The rate limit for the plan associated with this subscription has been exceeded. To see plans with higher rate limits, visit our pricing page.", $response->getStatusCode(), $retryAfterValue);
thrownewTooManyRequestsException($this->messageFrom($response, "Too Many Requests: The rate limit for your account has been exceeded."), $response->getStatusCode(), $retryAfterValue);
105
101
case500:
106
-
thrownewInternalServerErrorException("Internal Server Error.", $response->getStatusCode());
102
+
thrownewInternalServerErrorException($this->messageFrom($response, "Internal Server Error."), $response->getStatusCode());
thrownewServiceUnavailableException("Service Unavailable. Try again later.", $response->getStatusCode());
106
+
thrownewServiceUnavailableException($this->messageFrom($response, "Service Unavailable. Try again later."), $response->getStatusCode());
111
107
case504:
112
-
thrownewGatewayTimeoutException("The upstream data provider did not respond in a timely fashion and the request failed. A serious, yet rare occurrence indeed.", $response->getStatusCode());
108
+
thrownewGatewayTimeoutException($this->messageFrom($response, "The upstream data provider did not respond in a timely fashion and the request failed. A serious, yet rare occurrence indeed."), $response->getStatusCode());
113
109
default:
114
-
thrownewSmartyException("Error sending request. Status code is: ", $response->getStatusCode());
110
+
thrownewSmartyException($this->messageFrom($response, "The server returned an unexpected HTTP status code: " . $response->getStatusCode()), $response->getStatusCode());
0 commit comments