-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
When the API returns a bad request response, it is not properly handled by the library.
The API returns a JSON with key "Message"
example:
{"Message":"Tag handling parsing failed, please check input.\n\n'undefined entity: line 2, column 17' (at Line: 2, Column: 17)"}
The library assumes a key "message" (lowercase).
See Translator.php method checkStatusCode
$message = '';
try {
$json = json_decode($content, true, 512, \JSON_THROW_ON_ERROR);
if (isset($json['message'])) {
$message .= ", message: {$json['message']}";
}
if (isset($json['detail'])) {
$message .= ", detail: {$json['detail']}";
}
} catch (\Exception $e) {
// JSON parsing errors are ignored, and we fall back to the raw response
$message = ", $content";
}Thus the details of the error are lost, and this is very hard to debug in our projects.
Metadata
Metadata
Assignees
Labels
No labels