Post

This blog post reminds me of a blog post from Elixir community called "Let it fail". If you skip the whole BEAM / Elixir stuff, in particular this part: > Write less code by "ignoring" unexpected errors Where it talks about expected vs unexpected errors. yiming.dev/blog/2022/07...

yiming.devHow "let it fail" leads to simpler code - Yiming ChenThe biggest lesson I learned from the "Let it fail" philosophy, is to distinguish expected errors and unexpected errors. So we can safely ignore the unexpected, and only handle the expected errors in ...

🙌 Damn right! Dependencies are not free, they're permanent maintenance. If you can do the thing in a couple of lines of code just do it.

Great post. Do packages always start out so, or do you think this is a natural evolution of open source? Is it easier to submit a PR to address your edge case than fix your code locally? There’s probably some psychology at play here that we’d do well to understand.

Great article! I've always phrases it as pushing edge cases to the outer layers of your app when it interfaces with other systems or user input. All edge cases should be handled there so that your inner core remains simple and doesn't have to deal with a plethora of different types.

Conceptually rather than in the usual typing sense - know what inputs make sense, only design for those, validate for those, have patterns in the rest of your code that means things other than that can’t end up getting sent to that code…

Great post! As a maintainer of a relatively complex library (Sentry SDKs), I feel like we have to handle a lot of edge cases and graceful degredation is super important. Last thing you want is your error monitoring library breaking your app. But this really resonates with me on an API design level.

I noticed this in an older version of date-fns (v1 or v2), 90% of the function I was reading was validating inputs, latest uses TS and doesnt validate as much Before TypeScript and IDEs that understand TypeScript (even in JS), that was kind of the JS way of doing types... runtime validation