Skip to content

Commit 990715b

Browse files
authored
Update FixerIo.php
1 parent 2e6dafa commit 990715b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Drivers/FixerIo.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,14 @@ function apiRequest(string $endpoint, array $params = [], string $method = 'GET'
137137

138138
// Handle response exceptions.
139139
if ($response['success'] == false) {
140-
$message = "[{$response['error']['type']}]";
140+
$message = '';
141+
if (isset($response['error']['type'])) {
142+
$message = "[{$response['error']['type']}]";
143+
}
141144
if (isset($response['error']['info'])) {
142145
$message .= ' ' . $response['error']['info'];
143146
}
144-
throw new ApiException($message, $response['error']['code']);
147+
throw new ApiException(trim($message), $response['error']['code']);
145148
}
146149

147150
return $response;

0 commit comments

Comments
 (0)