Home

EXn

Exn is a shorthand used in several programming language communities to refer to the concept of an exception value. An exception represents an error or unusual condition that disrupts normal program flow and can be raised, propagated, and eventually handled by a corresponding handler. Depending on the language, exn may be a simple tag or a structured object carrying a message and additional metadata such as a location, stack trace, or continuation information.

In OCaml, exn is the built-in type of all exceptions. Exceptions are values of type exn and

In the Scheme family of languages, including Racket, exn (and related exn:… variants) denotes an exception object

Overall, exn localization varies by language but shares the core idea: a first-class value used to signal,

are
raised
with
the
raise
construct.
The
standard
library
provides
several
predefined
exceptions,
such
as
Failure
of
string,
Invalid_argument
of
string,
Division_by_zero,
Not_found,
and
Stack_overflow.
Users
can
also
declare
their
own
exceptions
using
the
exception
keyword,
typically
carrying
additional
payload
data.
Exceptions
in
OCaml
are
caught
with
a
try...with
construct,
often
using
pattern
matching
to
retrieve
the
payload.
or
record.
These
exceptions
can
include
fields
such
as
a
message,
a
culprit,
and
source
location.
They
are
created
and
raised
within
the
language's
error-handling
facilities
and
are
caught
by
corresponding
handlers,
allowing
structured
and
context-rich
error
management.
transport,
and
manage
error
conditions
separate
from
regular
return
values.
This
approach
supports
modular
error
handling,
composable
libraries,
and
the
ability
to
distinguish
different
error
kinds
through
pattern
matching
or
type-based
dispatch.