Skip to content

Commit

Permalink
Fix 'already initialized constant JWT Error'
Browse files Browse the repository at this point in the history
Change ruby error class definitions to prevent already initialized
warnings during gem usage.

Fixes #335.
  • Loading branch information
excpt committed Jul 7, 2020
1 parent 95d8d9f commit 57258e4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/jwt/error.rb
@@ -1,20 +1,20 @@
# frozen_string_literal: true

module JWT
EncodeError = Class.new(StandardError)
DecodeError = Class.new(StandardError)
RequiredDependencyError = Class.new(StandardError)
class EncodeError < StandardError; end
class DecodeError < StandardError; end
class RequiredDependencyError < StandardError; end

VerificationError = Class.new(DecodeError)
ExpiredSignature = Class.new(DecodeError)
IncorrectAlgorithm = Class.new(DecodeError)
ImmatureSignature = Class.new(DecodeError)
InvalidIssuerError = Class.new(DecodeError)
InvalidIatError = Class.new(DecodeError)
InvalidAudError = Class.new(DecodeError)
InvalidSubError = Class.new(DecodeError)
InvalidJtiError = Class.new(DecodeError)
InvalidPayload = Class.new(DecodeError)
class VerificationError < DecodeError; end
class ExpiredSignature < DecodeError; end
class IncorrectAlgorithm < DecodeError; end
class ImmatureSignature < DecodeError; end
class InvalidIssuerError < DecodeError; end
class InvalidIatError < DecodeError; end
class InvalidAudError < DecodeError; end
class InvalidSubError < DecodeError; end
class InvalidJtiError < DecodeError; end
class InvalidPayload < DecodeError; end

JWKError = Class.new(DecodeError)
class JWKError < DecodeError; end
end

0 comments on commit 57258e4

Please sign in to comment.