Exception

From HaskellWiki
Revision as of 21:04, 7 December 2007 by Lemming (talk | contribs) (explanation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

An exception denotes an unpredictable situation at runtime, like "out of disk storage", "read protected file", "user removed disk while reading", "syntax error in user input". These are situation which occur relatively seldom and thus their immediate handling would clutter the code which should describe the regular processing. Since exceptions must be expected at runtime there are also mechanisms for (selectively) handling them. (Control.Exception,try, Control.Exception.catch) Unfortunately the Haskell library names common exceptions of IO actions IOError. In general you should be very careful, not to mix up exceptions with errors. Actually, an unhandled exception is an error.

See also