Using the below code to define a custom exception does not let the extra
field be returned in responses where the error is raised:
class InvalidApiKeyError(NotAuthorizedException):
detail = "Invalid API key"
extra = "The API key you provided is invalid, incorrect, expired, has been revoked, or your account is overdue."
The below code doesn't work either:
class InvalidApiKeyError(NotAuthorizedException):
detail = "Invalid API key"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.extra = "The API key you provided is invalid, incorrect, expired, has been revoked, or your account is overdue."
No response
# Your MCVE code here
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
""
2.14.0
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too