7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/decode_this/safe_decoding.rb', line 7
def self.call(logger = nil, &block)
block.call
rescue JWT::ExpiredSignature => err
handle_and_log_error(
DecodeThis::DecodeError,
"Expired token #{err.class} - #{err.message}",
logger
)
rescue JWT::VerificationError => err
handle_and_log_error(
DecodeThis::DecodeError,
"Can't verify token #{err.class} - #{err.message}",
logger
)
rescue JWT::DecodeError => err
handle_and_log_error(
DecodeThis::DecodeError,
"Can't decode token '#{jwt_token}' #{err.class} - #{err.message}",
logger
)
rescue DecodeThis::KeyFileNotFoundError => err
handle_and_log_error(
DecodeThis::KeyFileNotFoundError,
err.message,
logger
)
end
|