You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the challenge creation endpoint simply calls challenge_class.create(request) and assumes the request succeeds. The challenge's create class method could raise an HTTPException for input validation issues, but this feels like a hack in the larger context.
The answer may simply be defining an HTTPException subclass which implements the APISimpleErrorResponse schema, but I'm not sure if that's the best move.
If I've missed something that already exists to handle invalid challenge creation input, then I'd be happy to be corrected here. Thanks! :)
The text was updated successfully, but these errors were encountered:
Yes it doesn't look like this is well defined in the code.
I think the smartest strategy would be to raise a custom exception that passes what the failing fields are as a dictionary. Then the API can return that dictionary in the overall response with success: False.
I don't think this strategy breaks anything so I can review/accept a PR for it whenever.
Currently, the challenge creation endpoint simply calls
challenge_class.create(request)
and assumes the request succeeds. The challenge's create class method could raise anHTTPException
for input validation issues, but this feels like a hack in the larger context.The answer may simply be defining an
HTTPException
subclass which implements theAPISimpleErrorResponse
schema, but I'm not sure if that's the best move.If I've missed something that already exists to handle invalid challenge creation input, then I'd be happy to be corrected here. Thanks! :)
The text was updated successfully, but these errors were encountered: