Exceptions vs. Errors (Re: Readline read_history and write_history addition)

Ketil Malde ketil+haskell at ii.uib.no
Wed Jan 23 06:32:20 EST 2008

"Yitzchak Gale" <gale at sefer.org> writes:

> The exact usage of the terms "error" and "exception" varies
> between programming languages. Your descriptions on
> the wiki follow Java usage, where Error and Exception
> are separate subclasses of Throwable. In Python, "exception"
> means the program flow construct, and "error" means a
> condition in which an exception is raised due to something
> going "wrong", so StandardError is a subclass of Exception.
> There are other conventions.

To me, (what you describe as) the Python terminology seems to be the
least confusing.  E.g., dividing by zero and failed pattern matches
are (run-time!) errors, which raise exceptions.

I wouldn't say (like the wiki) that an uncaught exception is an

> E1) The function is strongly in the IO monad.
> E2) The condition is rare.
> E3) Sometimes the correct action would be to exit the program
>     with an error message.

I like these criteria.

I'd even suggest replacing "Sometimes" with "Commonly" in E3. 
And add that there should be no obvious, general way to deal with
the error (but then there probably wouldn't be an error in the first

> E2 and E3 do not hold for in the case of readline
> history - if were to throw an IO exception in the case
> of empty history, it would be obligatory for every program
> using it to wrap the function in a try.

I don't know readline, but it looks like a clear candidate for (Maybe

If I haven't seen further, it is by standing in the footprints of giants

More information about the Libraries mailing list