Cydo
Explore posts from serversTrying to understand proper error handling
Yeah, sometimes it just feels like I'm doing way more in MVC to get a simple api going then I should really need to, so I figured switching to using minimal api would let me bring my ideas to life much quicker, i've read minimal api is a lot closer to express which is/was the backend i am most use to using, except I have moved away from even touching Js/Ts for anything outside the frontend lol
160 replies
Trying to understand proper error handling
The one method per controller seems insane to me, but having only been learning .NET for 144 days I'll leave that to my inexperience lol.
So overall, its probably better to use a result pattern and handle those errors then to use exceptions since its harder for outside users of an API to understand why/when an exception will be thrown?
But I also thought you can decorate ur endpoints in ur controller with
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
and that will document ur API's possible responses in Swagger? Or do you mean that even if it's documented like that, it doesnt actually tell you why/what will cause those exceptions to be thrown regardless?160 replies
Trying to understand proper error handling
@shua Turns out the repo was public this entire time lol, Im still trying to refactor everything back to using exceptions instead of my shotty Result pattern so its a bit of a messge in there, but i refactored at least the auth, and party service if u wanted to take a look and potentionally vomit
https://github.com/CydoEntis/collabparty-backend
160 replies
Trying to understand proper error handling
Yeah when I was writing the one implementation, it always seemed like I had to go back and add one more thing that I didnt think of at the time and it was getting more complex and overwhelming each iteration. I'm currently going back and just switching to throw exceptions now, my goal has changed from making this thing perfect using all these "design patterns" to just functioning deployed app.
160 replies