Skip to content

Commit af8e287

Browse files
committed
fix: add claim attribute on claim errors
ref #69
1 parent 6fd8622 commit af8e287

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/joserfc/errors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ class InvalidClaimError(JoseError):
158158
"""This error is designed for JWT. It raised when the claim contains
159159
invalid values or types."""
160160

161+
claim: str
161162
error = "invalid_claim"
162163

163164
def __init__(self, claim: str):
165+
self.claim = claim
164166
description = f"Invalid claim: '{claim}'"
165167
super(InvalidClaimError, self).__init__(description=description)
166168

@@ -169,9 +171,11 @@ class MissingClaimError(JoseError):
169171
"""This error is designed for JWT. It raised when the required
170172
claims are missing."""
171173

174+
claim: str
172175
error = "missing_claim"
173176

174177
def __init__(self, claim: str):
178+
self.claim = claim
175179
description = f"Missing claim: '{claim}'"
176180
super(MissingClaimError, self).__init__(description=description)
177181

@@ -180,9 +184,11 @@ class InsecureClaimError(JoseError):
180184
"""This error is designed for JWT. It raised when the claim
181185
contains sensitive information."""
182186

187+
claim: str
183188
error = "insecure_claim"
184189

185190
def __init__(self, claim: str):
191+
self.claim = claim
186192
description = f"Insecure claim '{claim}'"
187193
super(InsecureClaimError, self).__init__(description=description)
188194

0 commit comments

Comments
 (0)