error handling

Functional error handling in Scala

Because functional programming is like algebra, there are no null values or exceptions. But of course you can still have exceptions when you try to access servers that are down or files that are missing, so what can you do? This lesson demonstrates the techniques of functional error handling in Scala.

Principle of Least Power (Scala) alvin December 18, 2018 - 6:13am

In this video Martin Odersky shares an analogy of using a stapler when you need a stapler (not a power tool). He highly recommends reading Li Haoyi’s article, Principle of Least Power.

Perl exception handling

I've been working on a Perl module that makes sending email messages a breeze, but one problem I had is that the Perl module MIME::Lite has a nasty way of failing when something goes wrong. I could not "catch" it's errors with die or warn, so after a little research, I found out how to deal with this problem using eval. According to one text, using eval is the only mechanism Perl has for exception handling.

Here's what I was doing that didn't work: