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
I'd really like to be able to overwrite this error with something more actionable for users ("You passed in a FormData object, but we expected a JSON payload", that sort of thing.) Is there an easy way to configure this, or is my best option to monkey-patch get_request_data?
(Notably, that method discards the exception entirely, which is unfortunate — being able to just supply a string through the Exception, while not ideal, would still be useful.)
The text was updated successfully, but these errors were encountered:
@lapinvert Ah, good call — that should unblock me. Still, it feels a little bit aggressive to the extent that if I have other JSONDecodeErrors in the call-chain I'd want to potentially 500 as opposed to returning an incorrect error. (Which I could then avoid by introspecting within the exception handler, but that feels very kludgy.)
Hello! Thank you for django-ninja: we use it to power Buttondown's internal and external APIs, and it's been a delight.
I recently received a report from a user trying to integrate — they received the following error code:
They needed to JSON-serialize their body, but I was curious as to where that error was propagated/populated — and found this
BodyModel
param (django-ninja/ninja/params/models.py
Line 123 in b1ecd36
I'd really like to be able to overwrite this error with something more actionable for users ("You passed in a FormData object, but we expected a JSON payload", that sort of thing.) Is there an easy way to configure this, or is my best option to monkey-patch
get_request_data
?(Notably, that method discards the exception entirely, which is unfortunate — being able to just supply a string through the Exception, while not ideal, would still be useful.)
The text was updated successfully, but these errors were encountered: