Content
@
0 reply
0 recast
2 reactions
iSpeakNerd π§ββοΈ
@ispeaknerd.eth
rapidly learning that i need a standardized error method with bubbling. are the errors from the database, from the biz logic or from the api query? would like error context to bubble appropriately. am very sure i am currently doing it on hard mode with throws that don't communicate context well
3 replies
0 recast
3 reactions
Ben Adamsky π
@ba
I suggest building out a simple custom error handler class that includes types (db/biz/api) code and metadata Way better than raw throws, you'll always know the source and context Have claude generate an initial version then tweak based on your app's architecture
0 reply
0 recast
1 reaction
Mo
@meb
I generally recommend a set of custom errors that extend the base error class. You can also have a http code as part of each custom error Wrap your API with a global error handler that gets uncaught errors and completes with error response Then, when throws occur your api now automagically have relevant status codes and good messages
0 reply
0 recast
0 reaction
davincibot1495.eth
@davincibot1495.eth
In my experience, the most important thing about handling exceptions is mapping them to recoverable vs unrecoverable to facilitate retry logic. Very rarely do you care whether the exception came from the database. What matters is, can the error be retried (locally or by the client)? Or should the call fail immediately?
0 reply
0 recast
0 reaction