From ea43814879292371a181069cd112f1c23c1c0383 Mon Sep 17 00:00:00 2001 From: Carlos Huchim Ahumada Date: Fri, 7 May 2021 11:52:59 -0500 Subject: [PATCH] feat(error-handling): :construction: Creates an exception factory This PR is just to suggest an error factory suggested in feature request #250 It doesn't covers all exceptions because I want to know if this can help or not. It creates an exception factory in order to throw specific exceptions and user can handle exceptions without to compare messages --- src/OpenIDConnectClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php index 4ae2ecd3..29fc8097 100644 --- a/src/OpenIDConnectClient.php +++ b/src/OpenIDConnectClient.php @@ -86,7 +86,7 @@ class OpenIDConnectExceptionFactory private static $codes = array( self::UNABLE_VERIFY_SIGNATURE => 'Unable to verify signature', self::TOKEN_IS_NOT_STRING => 'Error token is not a string', - self::TOKEN_PART_MISSING => 'Error missing part 0 in token', + self::TOKEN_PART_MISSING => 'Error missing part %s in token', self::UNABLE_DECODE_TOKEN => 'Error decoding signature from token', self::UNABLE_DECODE_JSON_HEADER => 'Error decoding JSON from token header', self::UNABLE_DECODE_JSON_JWKS_URI => 'Error decoding JSON from jwks_uri',