diff --git a/lib/shopify_api/auth/jwt_payload.rb b/lib/shopify_api/auth/jwt_payload.rb index 2f37e74d..e61b92bb 100644 --- a/lib/shopify_api/auth/jwt_payload.rb +++ b/lib/shopify_api/auth/jwt_payload.rb @@ -75,8 +75,8 @@ def ==(other) def decode_token(token, api_secret_key) JWT.decode(token, api_secret_key, true, { exp_leeway: JWT_EXPIRATION_LEEWAY, algorithm: "HS256" })[0] - rescue - raise ShopifyAPI::Errors::InvalidJwtTokenError, "Failed to parse session token '#{token}'" + rescue JWT::DecodeError => err + raise ShopifyAPI::Errors::InvalidJwtTokenError, "Error decoding session token: #{err.message}" end end end