✅ Web API format for error response
What format do you usually use to respond with failure to the sent request? Do you return
ModelState
or ProblemDetails
?3 Replies
who you are sending the failure to? does it have the authorization to know what is going wrong? does it make sense to send error details to it?
I'm responding to the user, I want him to know why the status of the response is 404, or why his form submission failed, what data he must change
then do what it works for you, if in your frontend you can use a different model for say a bad request response, fine
if you need to inherit always same model from same endpoint then you need a wrapper with a state to tell read success field or error field