Hacker News new | past | comments | ask | show | jobs | submit login

In most web applications I write, I have one error-handling block.

Access forbidden? Log a warning and show a 403 page. Is is JSON? Then return JSON.

Exception-handling in general is a pretty small part of most applications. In Go, MOST of the application is error-handling, often just duplicate code that is a nightmare to maintain. I just don't get why people insist it's somehow better, after we "evolved" from the brute-force way.




Errors usually happen during IO, but not in the main business logic and those two can be neatly separated.

But If you are coming from java I can understand the single error handling block is more comfortable, but coming from JavaScript/Typescript it's much more easy to check if err != nil, than to debug errors I forgot to handle, during runtime.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: