Skip to content

Commit

Permalink
Cleaned up code syntax in whatIsResponseError
Browse files Browse the repository at this point in the history
  • Loading branch information
lamoni committed Jan 6, 2015
1 parent 7e51cec commit c79d09f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions JunosSpace.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,20 @@ public function getDeviceByID($deviceID)

public function whatIsResponseError(\Exception $e)
{

$errors = [
'User not authenticated' => 'Authentication to Junos Space failed: invalid credentials',
'User password expired' => 'Authentication to Junos Space failed: expired credentials'
];

foreach ($errors as $errorFind=>$errorMessage) {

if (strpos($e->getMessage(), $errorFind) !== false) {

throw new \Exception($errorMessage, 1);

}

}

throw $e;
Expand Down

0 comments on commit c79d09f

Please sign in to comment.