Error Handling Without Throwing Your Hands Up
underscore.io
underscore.io
This also ignores the fact that Java considers exceptions part of the method signature. Without opening the whole can of worms as to whether that was a good or a bad design decision, it seems a little perverse to talk about Java, but then choose a language (Scala) that deliberately hides the exceptions, and then complain they are hidden.
As for assuming that every method can throw an exception, yes in Scala and Java and most other languages you do have to have some top level exception handler. However the goal of modern type systems is to have the types an accurate reflection of effects of the method, so that the type system can catch errors for you. This post is about how you can do that.
* vomit
Compare "I was throwing my lunch up" vs "I was throwing up my lunch". A bit like "black" + "bird" (i.e. a bird with black feathers) vs "blackbird" (i.e. any subspecies of the genus Turdus or some icterid birds) -- "throwing" + "up" (i.e. throwing something in an upwards direction) vs "throwing up" (i.e. expunging the contents of your stomach).
I've never heard the form of words "to throw one's hands up", but it's obvious what it means. Therefore "throwing my hands up" and "throwing up my hands" make equal sense and are equally humorous.
(Not that it matters, of course there's no real ambiguity here)
"error handling without throwing up your lunch"
document.getElementsByClassName("blog-post-content")[0].style.fontWeight = 500