diff --git a/JunosSpace.php b/JunosSpace.php index 4fafc97..ce87d66 100644 --- a/JunosSpace.php +++ b/JunosSpace.php @@ -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;