Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #45 from moltin/chg/support-error-and-errors-keys
Browse files Browse the repository at this point in the history
Change support error and errors log
  • Loading branch information
zot24 committed Apr 8, 2016
2 parents a4dae7e + 9ba6754 commit 1222604
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Authenticate/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public function authenticate($args, \Moltin\SDK\SDK $parent)
// Check response
$result = json_decode($result, true);

// Fix backward compatibility with new services
if (!isset($result['errors']) && isset($result['error'])) {
$result['errors'] = $result['error'];
unset($result['error']);
}

// Check JSON for errors
if (isset($result['errors'])) {
$exception = null;
Expand Down
6 changes: 6 additions & 0 deletions src/Authenticate/Implicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public function authenticate($args, \Moltin\SDK\SDK $parent)
// Check response
$result = json_decode($result, true);

// Fix backward compatibility with new services
if (!isset($result['errors']) && isset($result['error'])) {
$result['errors'] = $result['error'];
unset($result['error']);
}

// Check JSON for errors
if (isset($result['errors'])) {
$exception = null;
Expand Down
6 changes: 6 additions & 0 deletions src/Authenticate/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public function authenticate($args, \Moltin\SDK\SDK $parent)
// Check response
$result = json_decode($result, true);

// Fix backward compatibility with new services
if (!isset($result['errors']) && isset($result['error'])) {
$result['errors'] = $result['error'];
unset($result['error']);
}

// Check JSON for errors
if (isset($result['errors'])) {
$exception = null;
Expand Down
6 changes: 6 additions & 0 deletions src/Authenticate/Refresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public function authenticate($args, \Moltin\SDK\SDK $parent)
// Check response
$result = json_decode($result, true);

// Fix backward compatibility with new services
if (!isset($result['errors']) && isset($result['error'])) {
$result['errors'] = $result['error'];
unset($result['error']);
}

// Check JSON for errors
if (isset($result['errors'])) {
$exception = null;
Expand Down

0 comments on commit 1222604

Please sign in to comment.