C
C#5mo ago
Alex

✅ 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
Omnissiah
Omnissiah5mo ago
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?
Alex
AlexOP5mo ago
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
Omnissiah
Omnissiah5mo ago
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
Want results from more Discord servers?
Add your server