Sandro Maglione πŸ’» Profile picture
Functional programming on the frontend ⌨️ | Open source 🌍 - Flutter/Dart & Typescript πŸ”₯ | Creator of #fpdart | πŸ‘¨β€πŸ’» https://t.co/bvYHyCSHPb
Oct 18, 2022 β€’ 15 tweets β€’ 4 min read
Error handling is hard, harder than you think πŸ€”

Let's just see a simple example πŸ’πŸΌβ€β™‚οΈ

In how many ways can this #dart code below fail?

The answer will surprise you πŸ‘‡πŸ§΅ Image Note: fail can mean different things ☝️

Here we mean anything that will crash the app (if not handled)

Errors or Exceptions πŸ‘‡

Oct 17, 2022 β€’ 12 tweets β€’ 4 min read
What if your #flutter app fails? Should you throw? Error? Exception?

#dart gives you both Error and Exception 🎯

But how do they work? Which one should you choose? πŸ€”

Here is the answer πŸ‘‡πŸ§΅ Error & Exception ‼️

#dart has both of them, but they are not the same πŸ’πŸΌβ€β™‚οΈ

πŸ‘‰ Exceptions: conditions that you can plan ahead for *and catch*

πŸ‘‰ Errors: conditions that *you don’t expect*