Skip to content

Commit ae044f4

Browse files
committed
Bugfix: Improved robustness by catching all exceptions during getAccessToken and getUserData
1 parent 04149f8 commit ae044f4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/LoginWithAuthorizationProviderAction.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,18 @@ public function handle(ServerRequestInterface $request): ResponseInterface
233233
'email' => $user_data_from_provider->email(),
234234
]));
235235

236-
} catch (IdentityProviderException $e) {
236+
} catch (Exception $e) {
237237

238238
// Failed to get the access token or user details.
239-
CustomModuleLog::addDebugLog($log_module, 'Failed to get the access token or user details' . ': ' . $e->getMessage());
239+
$error_message = $e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine();
240+
CustomModuleLog::addDebugLog($log_module, 'Failed to get the access token or user details' . ': ' . $error_message);
240241

241242
return $this->viewResponse(OAuth2Client::viewsNamespace() . '::alert', [
242243
'title' => I18N::translate('OAuth 2.0 communication error'),
243244
'tree' => $tree instanceof Tree ? $tree : null,
244245
'alert_type' => OAuth2Client::ALERT_DANGER,
245246
'module_name' => $oauth2_client->title(),
246-
'text' => I18N::translate('Failed to get the access token or the user details from the authorization provider') . ': ' . $e->getMessage(),
247+
'text' => I18N::translate('Failed to get the access token or the user details from the authorization provider') . ': ' . $error_message,
247248
]);
248249
}
249250
}

0 commit comments

Comments
 (0)