Skip to content

Commit 0e8b40e

Browse files
author
Benjamin Wilson Friedman
authored
Add check and conversion to String from Array for 'error' in ParseClient (#268)
Added check and conversion to string from Array for 'error' in back4app.com API response * Add comments to clarify intent of additions
1 parent 3f8bf7f commit 0e8b40e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Parse/ParseClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,11 @@ public static function _request(
372372

373373
$decoded = json_decode($response, true);
374374
if (isset($decoded['error'])) {
375+
// check to convert error to a string, if an array
376+
// used to handle an Array 'error' from back4app.com
377+
$errorMessage = is_array($decoded['error']) ? json_encode($decoded['error']) : $decoded['error'];
375378
throw new ParseException(
376-
$decoded['error'],
379+
$errorMessage,
377380
isset($decoded['code']) ? $decoded['code'] : 0
378381
);
379382
}

0 commit comments

Comments
 (0)