Skip to content

Commit 534d94b

Browse files
more specific exception message
1 parent 4b1f271 commit 534d94b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

languages/php/src/BitwardenClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public function login_access_token(string $access_token, string $state_file): vo
2525
$access_token_request->stateFile = $state_file;
2626
$command = new Command();
2727
$command->loginAccessToken = $access_token_request->jsonSerialize();
28-
$result = $this->commandRunner->run($command);
29-
if (!isset($result->authenticated)) {
30-
throw new \Exception("Authorization error");
31-
}
32-
33-
if ($result->authenticated == false) {
34-
throw new \Exception("Unauthorized");
28+
try {
29+
$result = $this->commandRunner->run($command);
30+
if (!isset($result->authenticated) || !$result->authenticated) {
31+
throw new Exception("Unauthorized");
32+
}
33+
} catch (Exception $exception) {
34+
throw new Exception("Authorization error: " . $exception->getMessage());
3535
}
3636
}
3737
}

0 commit comments

Comments
 (0)