Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of people ask this / answer this focusing on how to more easy collect / thread errors.

I think most of the time the real answer is to not have so many errors. You shouldn't return errors when API users make mistakes (as Java does); you should panic. You shouldn't return errors when something is "missing" (as Python does); you should return a zero value, and that zero value should sometimes still be useful.

In general you should be trying to write total functions, and picking your types so you can write total functions, and panicking rather than erroring if your preconditions are violated.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: