<s>
In	O
computing	O
and	O
computer	B-General_Concept
programming	I-General_Concept
,	O
exception	B-General_Concept
handling	I-General_Concept
is	O
the	O
process	O
of	O
responding	O
to	O
the	O
occurrence	O
of	O
exceptions	O
–	O
anomalous	O
or	O
exceptional	O
conditions	O
requiring	O
special	O
processing	O
–	O
during	O
the	O
execution	B-General_Concept
of	O
a	O
program	B-Application
.	O
</s>
<s>
In	O
general	O
,	O
an	O
exception	O
breaks	O
the	O
normal	O
flow	O
of	O
execution	B-General_Concept
and	O
executes	O
a	O
pre-registered	O
exception	B-General_Concept
handler	I-General_Concept
;	O
the	O
details	O
of	O
how	O
this	O
is	O
done	O
depend	O
on	O
whether	O
it	O
is	O
a	O
hardware	B-Architecture
or	O
software	O
exception	O
and	O
how	O
the	O
software	O
exception	O
is	O
implemented	O
.	O
</s>
<s>
Exception	B-General_Concept
handling	I-General_Concept
,	O
if	O
provided	O
,	O
is	O
facilitated	O
by	O
specialized	O
programming	O
language	O
constructs	O
,	O
hardware	B-Architecture
mechanisms	O
like	O
interrupts	B-Application
,	O
or	O
operating	B-General_Concept
system	I-General_Concept
(	O
OS	O
)	O
inter-process	B-Operating_System
communication	I-Operating_System
(	O
IPC	O
)	O
facilities	O
like	O
signals	B-Operating_System
.	O
</s>
<s>
Some	O
exceptions	O
,	O
especially	O
hardware	B-Architecture
ones	O
,	O
may	O
be	O
handled	O
so	O
gracefully	O
that	O
execution	B-General_Concept
can	O
resume	O
where	O
it	O
was	O
interrupted	O
.	O
</s>
<s>
An	O
exception	B-General_Concept
handling	I-General_Concept
mechanism	O
allows	O
the	O
procedure	O
to	O
raise	O
an	O
exception	O
if	O
this	O
precondition	O
is	O
violated	O
,	O
for	O
example	O
if	O
the	O
procedure	O
has	O
been	O
called	O
on	O
an	O
abnormal	O
set	O
of	O
arguments	O
.	O
</s>
<s>
The	O
exception	B-General_Concept
handling	I-General_Concept
mechanism	O
then	O
handles	O
the	O
exception	O
.	O
</s>
<s>
value	O
is	O
outside	O
of	O
the	O
domain	B-Algorithm
of	I-Algorithm
a	I-Algorithm
function	I-Algorithm
)	O
,	O
an	O
unavailable	O
resource	O
(	O
like	O
a	O
missing	O
file	O
,	O
a	O
hard	O
disk	O
error	O
,	O
or	O
out-of-memory	O
errors	O
)	O
,	O
or	O
that	O
the	O
routine	O
has	O
detected	O
a	O
normal	O
condition	O
that	O
requires	O
special	O
handling	O
,	O
e.g.	O
,	O
attention	O
,	O
end	O
of	O
file	O
.	O
</s>
<s>
Exception	B-General_Concept
handling	I-General_Concept
solves	O
the	O
semipredicate	O
problem	O
,	O
in	O
that	O
the	O
mechanism	O
distinguishes	O
normal	O
return	O
values	O
from	O
erroneous	O
ones	O
.	O
</s>
<s>
In	O
languages	O
without	O
built-in	O
exception	B-General_Concept
handling	I-General_Concept
such	O
as	O
C	O
,	O
routines	O
would	O
need	O
to	O
signal	B-Operating_System
the	O
error	O
in	O
some	O
other	O
way	O
,	O
such	O
as	O
the	O
common	O
return	B-Application
code	I-Application
and	O
errno	B-Error_Name
pattern	O
.	O
</s>
<s>
Taking	O
a	O
broad	O
view	O
,	O
errors	O
can	O
be	O
considered	O
to	O
be	O
a	O
proper	O
subset	O
of	O
exceptions	O
,	O
and	O
explicit	O
error	O
mechanisms	O
such	O
as	O
errno	B-Error_Name
can	O
be	O
considered	O
(	O
verbose	O
)	O
forms	O
of	O
exception	B-General_Concept
handling	I-General_Concept
.	O
</s>
<s>
Even	O
the	O
term	O
"	O
exception	O
"	O
may	O
be	O
misleading	O
because	O
its	O
typical	O
connotation	O
of	O
"	O
outlier	O
"	O
indicates	O
that	O
something	O
infrequent	O
or	O
unusual	O
has	O
occurred	O
,	O
when	O
in	O
fact	O
raising	O
the	O
exception	O
may	O
be	O
a	O
normal	O
and	O
usual	O
situation	O
in	O
the	O
program	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
suppose	O
a	O
lookup	O
function	O
for	O
an	O
associative	B-Application
array	I-Application
throws	O
an	O
exception	O
if	O
the	O
key	O
has	O
no	O
value	O
associated	O
.	O
</s>
<s>
The	O
first	O
hardware	B-General_Concept
exception	I-General_Concept
handling	O
was	O
found	O
in	O
the	B-Operating_System
UNIVAC	I-Operating_System
I	O
from	O
1951	O
.	O
</s>
<s>
Software	O
exception	B-General_Concept
handling	I-General_Concept
developed	O
in	O
the	O
1960s	O
and	O
1970s	O
.	O
</s>
<s>
LISP	B-Language
1.5	I-Language
(	O
1958-1961	O
)	O
allowed	O
exceptions	O
to	O
be	O
raised	O
by	O
the	O
ERROR	O
pseudo-function	O
,	O
similarly	O
to	O
errors	O
raised	O
by	O
the	O
interpreter	O
or	O
compiler	O
.	O
</s>
<s>
Exceptions	O
were	O
caught	O
by	O
the	O
ERRORSET	O
keyword	O
,	O
which	O
returned	O
NIL	B-Language
in	O
case	O
of	O
an	O
error	O
,	O
instead	O
of	O
terminating	O
the	O
program	B-Application
or	O
entering	O
the	O
debugger	O
.	O
</s>
<s>
PL/I	B-Language
introduced	O
its	O
own	O
form	O
of	O
exception	B-General_Concept
handling	I-General_Concept
circa	O
1964	O
,	O
allowing	O
interrupts	B-Application
to	O
be	O
handled	O
with	O
ON	O
units	O
.	O
</s>
<s>
MacLisp	B-Language
observed	O
that	O
ERRSET	O
and	O
ERR	O
were	O
used	O
not	O
only	O
for	O
error	O
raising	O
,	O
but	O
for	O
non-local	O
control	O
flow	O
,	O
and	O
thus	O
added	O
two	O
new	O
keywords	O
,	O
CATCH	O
and	O
THROW	O
(	O
June	O
1972	O
)	O
.	O
</s>
<s>
The	O
cleanup	O
behavior	O
now	O
generally	O
called	O
"	O
finally	O
"	O
was	O
introduced	O
in	O
NIL	B-Language
(	O
New	O
Implementation	O
of	O
LISP	B-Language
)	O
in	O
the	O
mid	O
-	O
to	O
late-1970s	O
as	O
UNWIND-PROTECT	O
.	O
</s>
<s>
This	O
was	O
then	O
adopted	O
by	O
Common	B-Language
Lisp	I-Language
.	O
</s>
<s>
The	O
first	O
papers	O
on	O
structured	B-Library
exception	I-Library
handling	I-Library
were	O
and	O
.	O
</s>
<s>
Exception	B-General_Concept
handling	I-General_Concept
was	O
subsequently	O
widely	O
adopted	O
by	O
many	O
programming	O
languages	O
from	O
the	O
1980s	O
onward	O
.	O
</s>
<s>
There	O
is	O
no	O
clear	O
consensus	O
as	O
to	O
the	O
exact	O
meaning	O
of	O
an	O
exception	O
with	O
respect	O
to	O
hardware	B-Architecture
.	O
</s>
<s>
From	O
the	O
implementation	O
point	O
of	O
view	O
,	O
it	O
is	O
handled	O
identically	O
to	O
an	O
interrupt	B-Application
:	O
the	O
processor	O
halts	O
execution	B-General_Concept
of	O
the	O
current	O
program	B-Application
,	O
looks	O
up	O
the	O
interrupt	B-General_Concept
handler	I-General_Concept
in	O
the	O
interrupt	B-General_Concept
vector	I-General_Concept
table	I-General_Concept
for	O
that	O
exception	O
or	O
interrupt	B-Application
condition	O
,	O
saves	O
state	O
,	O
and	O
switches	O
control	O
.	O
</s>
<s>
Exception	B-General_Concept
handling	I-General_Concept
in	O
the	O
IEEE	O
754	O
floating-point	O
standard	O
refers	O
in	O
general	O
to	O
exceptional	O
conditions	O
and	O
defines	O
an	O
exception	O
as	O
"	O
an	O
event	O
that	O
occurs	O
when	O
an	O
operation	O
on	O
some	O
particular	O
operands	O
has	O
no	O
outcome	O
suitable	O
for	O
every	O
reasonable	O
application	O
.	O
</s>
<s>
That	O
operation	O
might	O
signal	B-Operating_System
one	O
or	O
more	O
exceptions	O
by	O
invoking	O
the	O
default	O
or	O
,	O
if	O
explicitly	O
requested	O
,	O
a	O
language-defined	O
alternate	O
handling.	O
"	O
</s>
<s>
The	O
default	O
IEEE	O
754	O
exception	B-General_Concept
handling	I-General_Concept
behaviour	O
of	O
resumption	O
following	O
pre-substitution	O
of	O
a	O
default	O
value	O
avoids	O
the	O
risks	O
inherent	O
in	O
changing	O
flow	O
of	O
program	B-Application
control	O
on	O
numerical	O
exceptions	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
1996	O
Cluster	B-Language
spacecraft	I-Language
launch	O
ended	O
in	O
a	O
catastrophic	O
explosion	O
due	O
in	O
part	O
to	O
the	O
Ada	B-Language
exception	B-General_Concept
handling	I-General_Concept
policy	O
of	O
aborting	O
computation	O
on	O
arithmetic	O
error	O
.	O
</s>
<s>
William	O
Kahan	O
claims	O
the	O
default	O
IEEE	O
754	O
exception	B-General_Concept
handling	I-General_Concept
behavior	O
would	O
have	O
prevented	O
this	O
.	O
</s>
<s>
Software	O
exception	B-General_Concept
handling	I-General_Concept
and	O
the	O
support	O
provided	O
by	O
software	O
tools	O
differs	O
somewhat	O
from	O
what	O
is	O
understood	O
by	O
exception	B-General_Concept
handling	I-General_Concept
in	O
hardware	B-Architecture
,	O
but	O
similar	O
concepts	O
are	O
involved	O
.	O
</s>
<s>
In	O
programming	O
language	O
mechanisms	O
for	O
exception	B-General_Concept
handling	I-General_Concept
,	O
the	O
term	O
exception	O
is	O
typically	O
used	O
in	O
a	O
specific	O
sense	O
to	O
denote	O
a	O
data	O
structure	O
storing	O
information	O
about	O
an	O
exceptional	O
condition	O
.	O
</s>
<s>
Execution	B-General_Concept
is	O
transferred	O
to	O
a	O
"	O
catch	O
"	O
.	O
</s>
<s>
Languages	O
where	O
exceptions	O
are	O
designed	O
to	O
be	O
used	O
as	O
flow	O
control	O
structures	O
:	O
Ada	B-Language
,	O
Modula-3	B-Language
,	O
ML	B-Language
,	O
OCaml	B-Language
,	O
PL/I	B-Language
,	O
Python	B-Language
,	O
and	O
Ruby	B-Language
fall	O
in	O
this	O
category	O
.	O
</s>
<s>
For	O
example	O
,	O
Python	B-Language
's	O
iterators	O
throw	O
StopIteration	O
exceptions	O
to	O
signal	B-Operating_System
that	O
there	O
are	O
no	O
further	O
items	O
produced	O
by	O
the	O
iterator	O
.	O
</s>
<s>
Languages	O
where	O
exceptions	O
are	O
only	O
used	O
to	O
handle	O
abnormal	O
,	O
unpredictable	O
,	O
erroneous	O
situations	O
:	O
C++	B-Language
,	O
Java	B-Language
,	O
C#	B-Application
,	O
Common	B-Language
Lisp	I-Language
,	O
Eiffel	B-Language
,	O
and	O
Modula-2	O
.	O
</s>
<s>
PL/I	B-Language
used	O
dynamically	O
scoped	O
exceptions	O
.	O
</s>
<s>
PL/I	B-Language
exception	B-General_Concept
handling	I-General_Concept
included	O
events	O
that	O
are	O
not	O
errors	O
,	O
e.g.	O
,	O
attention	O
,	O
end-of-file	O
,	O
modification	O
of	O
listed	O
variables	O
.	O
</s>
<s>
Many	O
computer	O
languages	O
have	O
built-in	O
syntactic	O
support	O
for	O
exceptions	O
and	O
exception	B-General_Concept
handling	I-General_Concept
.	O
</s>
<s>
This	O
includes	O
ActionScript	B-Operating_System
,	O
Ada	B-Language
,	O
BlitzMax	B-Language
,	O
C++	B-Language
,	O
C#	B-Application
,	O
Clojure	B-Language
,	O
COBOL	B-Application
,	O
D	B-Application
,	O
ECMAScript	B-Language
,	O
Eiffel	B-Language
,	O
Java	B-Language
,	O
ML	B-Language
,	O
Object	B-Language
Pascal	I-Language
(	O
e.g.	O
</s>
<s>
Delphi	B-Language
,	O
Free	B-Operating_System
Pascal	I-Operating_System
,	O
and	O
the	O
like	O
)	O
,	O
PowerBuilder	B-Language
,	O
Objective-C	B-Language
,	O
OCaml	B-Language
,	O
PHP	B-Application
(	O
as	O
of	O
version	O
5	O
)	O
,	O
PL/I	B-Language
,	O
PL/SQL	B-Language
,	O
Prolog	B-Language
,	O
Python	B-Language
,	O
REALbasic	B-Application
,	O
Ruby	B-Language
,	O
Scala	B-Application
,	O
Seed7	B-Language
,	O
Smalltalk	B-Application
,	O
Tcl	B-Operating_System
,	O
Visual	B-Application
Prolog	I-Application
and	O
most	O
.NET	B-Application
languages	O
.	O
</s>
<s>
Excluding	O
minor	O
syntactic	O
differences	O
,	O
there	O
are	O
only	O
a	O
couple	O
of	O
exception	B-General_Concept
handling	I-General_Concept
styles	O
in	O
use	O
.	O
</s>
<s>
with	O
Java	B-Language
or	O
Object	B-Language
Pascal	I-Language
)	O
or	O
a	O
value	O
of	O
a	O
special	O
extendable	O
enumerated	O
type	O
(	O
e.g.	O
</s>
<s>
with	O
Ada	B-Language
or	O
SML	O
)	O
.	O
</s>
<s>
The	O
scope	O
for	O
exception	B-General_Concept
handlers	I-General_Concept
starts	O
with	O
a	O
marker	O
clause	O
(	O
try	O
or	O
the	O
language	O
's	O
block	O
starter	O
such	O
as	O
begin	O
)	O
and	O
ends	O
in	O
the	O
start	O
of	O
the	O
first	O
handler	O
clause	O
(	O
catch	O
,	O
except	O
,	O
rescue	O
)	O
.	O
</s>
<s>
Notably	O
,	O
C++	B-Language
does	O
not	O
provide	O
this	O
construct	O
,	O
recommending	O
instead	O
the	O
Resource	B-Application
Acquisition	I-Application
Is	I-Application
Initialization	I-Application
(	O
RAII	B-Application
)	O
technique	O
which	O
frees	O
resources	O
using	O
destructors	B-Language
.	O
</s>
<s>
According	O
to	O
a	O
2008	O
paper	O
by	O
Westley	O
Weimer	O
and	O
George	O
Necula	O
,	O
the	O
syntax	O
of	O
the	O
try	O
...	O
finally	O
blocks	O
in	O
Java	B-Language
is	O
a	O
contributing	O
factor	O
to	O
software	O
defects	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
use	O
a	O
single	O
try	O
...	O
finally	O
block	O
even	O
when	O
dealing	O
with	O
multiple	O
resources	O
,	O
but	O
that	O
requires	O
a	O
correct	O
use	O
of	O
sentinel	B-Data_Structure
values	I-Data_Structure
,	O
which	O
is	O
another	O
common	O
source	O
of	O
bugs	O
for	O
this	O
type	O
of	O
problem	O
.	O
</s>
<s>
Python	B-Language
and	O
Ruby	B-Language
also	O
permit	O
a	O
clause	O
(	O
else	O
)	O
that	O
is	O
used	O
in	O
case	O
no	O
exception	O
occurred	O
before	O
the	O
end	O
of	O
the	O
handler	O
's	O
scope	O
was	O
reached	O
.	O
</s>
<s>
In	O
its	O
whole	O
,	O
exception	B-General_Concept
handling	I-General_Concept
code	O
might	O
look	O
like	O
this	O
(	O
in	O
Java-like	O
pseudocode	B-Language
)	O
:	O
</s>
<s>
C	O
does	O
not	O
have	O
try-catch	O
exception	B-General_Concept
handling	I-General_Concept
,	O
but	O
uses	O
return	B-Application
codes	I-Application
for	O
error	O
checking	O
.	O
</s>
<s>
The	O
setjmp	B-Language
and	O
longjmp	B-Language
standard	O
library	O
functions	O
can	O
be	O
used	O
to	O
implement	O
try-catch	O
handling	O
via	O
macros	O
.	O
</s>
<s>
Perl	B-Language
5	O
uses	O
die	O
for	O
throw	O
and	O
for	O
try-catch	O
.	O
</s>
<s>
When	O
an	O
exception	O
is	O
thrown	O
,	O
the	O
program	B-Application
searches	O
back	O
through	O
the	O
stack	B-General_Concept
of	O
function	O
calls	O
until	O
an	O
exception	B-General_Concept
handler	I-General_Concept
is	O
found	O
.	O
</s>
<s>
Some	O
languages	O
call	O
for	O
unwinding	O
the	O
stack	B-General_Concept
as	O
this	O
search	O
progresses	O
.	O
</s>
<s>
Alternately	O
,	O
the	O
exception	B-General_Concept
handling	I-General_Concept
mechanisms	O
may	O
not	O
unwind	O
the	O
stack	B-General_Concept
on	O
entry	O
to	O
an	O
exception	B-General_Concept
handler	I-General_Concept
,	O
giving	O
the	O
exception	B-General_Concept
handler	I-General_Concept
the	O
option	O
to	O
restart	O
the	O
computation	O
,	O
resume	O
or	O
unwind	O
.	O
</s>
<s>
This	O
allows	O
the	O
program	B-Application
to	O
continue	O
the	O
computation	O
at	O
exactly	O
the	O
same	O
place	O
where	O
the	O
error	O
occurred	O
(	O
for	O
example	O
when	O
a	O
previously	O
missing	O
file	O
has	O
become	O
available	O
)	O
or	O
to	O
implement	O
notifications	O
,	O
logging	O
,	O
queries	O
and	O
fluid	O
variables	O
on	O
top	O
of	O
the	O
exception	B-General_Concept
handling	I-General_Concept
mechanism	O
(	O
as	O
done	O
in	O
Smalltalk	B-Application
)	O
.	O
</s>
<s>
C++	B-Language
standardization	O
discussions	O
in	O
1989	O
–	O
1991	O
resulted	O
in	O
a	O
definitive	O
decision	O
to	O
use	O
termination	O
semantics	O
in	O
C++	B-Language
.	O
</s>
<s>
Exception-handling	O
languages	O
with	O
resumption	O
include	O
Common	B-Language
Lisp	I-Language
with	O
its	O
Condition	O
System	O
,	O
PL/I	B-Language
,	O
Dylan	B-Language
,	O
R	O
,	O
and	O
Smalltalk	B-Application
.	O
</s>
<s>
However	O
,	O
the	O
majority	O
of	O
newer	O
programming	O
languages	O
follow	O
C++	B-Language
and	O
use	O
termination	O
semantics	O
.	O
</s>
<s>
The	O
implementation	O
of	O
exception	B-General_Concept
handling	I-General_Concept
in	O
programming	O
languages	O
typically	O
involves	O
a	O
fair	O
amount	O
of	O
support	O
from	O
both	O
a	O
code	O
generator	O
and	O
the	O
runtime	B-Device
system	I-Device
accompanying	O
a	O
compiler	O
.	O
</s>
<s>
(	O
It	O
was	O
the	O
addition	O
of	O
exception	B-General_Concept
handling	I-General_Concept
to	O
C++	B-Language
that	O
ended	O
the	O
useful	O
lifetime	O
of	O
the	O
original	O
C++	B-Language
compiler	O
,	O
Cfront	B-Device
.	O
)	O
</s>
<s>
The	O
first	O
,	O
,	O
generates	O
code	O
that	O
continually	O
updates	O
structures	O
about	O
the	O
program	B-Application
state	O
in	O
terms	O
of	O
exception	B-General_Concept
handling	I-General_Concept
.	O
</s>
<s>
Typically	O
,	O
this	O
adds	O
a	O
new	O
element	O
to	O
the	O
stack	B-General_Concept
frame	I-General_Concept
layout	I-General_Concept
that	O
knows	O
what	O
handlers	O
are	O
available	O
for	O
the	O
function	O
or	O
method	O
associated	O
with	O
that	O
frame	O
;	O
if	O
an	O
exception	O
is	O
thrown	O
,	O
a	O
pointer	O
in	O
the	O
layout	O
directs	O
the	O
runtime	B-Library
to	O
the	O
appropriate	O
handler	O
code	O
.	O
</s>
<s>
This	O
approach	O
is	O
compact	O
in	O
terms	O
of	O
space	O
,	O
but	O
adds	O
execution	B-General_Concept
overhead	O
on	O
frame	O
entry	O
and	O
exit	O
.	O
</s>
<s>
It	O
was	O
commonly	O
used	O
in	O
many	O
Ada	B-Language
implementations	O
,	O
for	O
example	O
,	O
where	O
complex	O
generation	O
and	O
runtime	B-Library
support	O
was	O
already	O
needed	O
for	O
many	O
other	O
language	O
features	O
.	O
</s>
<s>
Microsoft	O
's	O
32-bit	O
Structured	B-Library
Exception	I-Library
Handling	I-Library
(	O
SEH	B-Library
)	O
uses	O
this	O
approach	O
with	O
a	O
separate	O
exception	O
stack	B-General_Concept
.	O
</s>
<s>
The	O
second	O
scheme	O
,	O
and	O
the	O
one	O
implemented	O
in	O
many	O
production-quality	O
C++	B-Language
compilers	O
and	O
64-bit	O
Microsoft	O
SEH	B-Library
,	O
is	O
a	O
.	O
</s>
<s>
This	O
creates	O
static	O
tables	O
at	O
compile	B-Application
time	I-Application
and	O
link	B-Application
time	I-Application
that	O
relate	O
ranges	O
of	O
the	O
program	B-General_Concept
counter	I-General_Concept
to	O
the	O
program	B-Application
state	O
with	O
respect	O
to	O
exception	B-General_Concept
handling	I-General_Concept
.	O
</s>
<s>
Then	O
,	O
if	O
an	O
exception	O
is	O
thrown	O
,	O
the	O
runtime	B-Device
system	I-Device
looks	O
up	O
the	O
current	B-General_Concept
instruction	I-General_Concept
location	O
in	O
the	O
tables	O
and	O
determines	O
what	O
handlers	O
are	O
in	O
play	O
and	O
what	O
needs	O
to	O
be	O
done	O
.	O
</s>
<s>
So	O
if	O
an	O
exception	O
is	O
thrown	O
then	O
a	O
performance	O
hit	O
–	O
roughly	O
comparable	O
to	O
a	O
function	O
call	O
–	O
may	O
occur	O
if	O
the	O
necessary	O
exception	B-General_Concept
handling	I-General_Concept
code	O
needs	O
to	O
be	O
loaded/cached	O
.	O
</s>
<s>
Since	O
exceptions	O
in	O
C++	B-Language
are	O
supposed	O
to	O
be	O
exceptional	O
(	O
i.e.	O
</s>
<s>
uncommon/rare	O
)	O
events	O
,	O
the	O
phrase	O
"	O
zero-cost	O
exceptions	O
"	O
is	O
sometimes	O
used	O
to	O
describe	O
exception	B-General_Concept
handling	I-General_Concept
in	O
C++	B-Language
.	O
</s>
<s>
Like	O
runtime	B-Application
type	I-Application
identification	I-Application
(	O
RTTI	B-Application
)	O
,	O
exceptions	O
might	O
not	O
adhere	O
to	O
C++'s	O
as	O
implementing	O
exception	B-General_Concept
handling	I-General_Concept
at	O
run-time	O
requires	O
a	O
non-zero	O
amount	O
of	O
memory	O
for	O
the	O
lookup	O
table	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
exception	B-General_Concept
handling	I-General_Concept
(	O
and	O
RTTI	B-Application
)	O
can	O
be	O
disabled	O
in	O
many	O
C++	B-Language
compilers	O
,	O
which	O
may	O
be	O
useful	O
for	O
systems	O
with	O
very	O
limited	O
memory	O
(	O
such	O
as	O
embedded	B-Architecture
systems	I-Architecture
)	O
.	O
</s>
<s>
This	O
second	O
approach	O
is	O
also	O
superior	O
in	O
terms	O
of	O
achieving	O
thread	B-Operating_System
safety	I-Operating_System
.	O
</s>
<s>
For	O
languages	O
that	O
support	O
metaprogramming	B-Application
,	O
approaches	O
that	O
involve	O
no	O
overhead	O
at	O
all	O
(	O
beyond	O
the	O
already	O
present	O
support	O
for	O
reflection	B-Language
)	O
have	O
been	O
advanced	O
.	O
</s>
<s>
A	O
different	O
view	O
of	O
exceptions	O
is	O
based	O
on	O
the	O
principles	O
of	O
design	B-Application
by	I-Application
contract	I-Application
and	O
is	O
supported	O
in	O
particular	O
by	O
the	O
Eiffel	B-Language
language	I-Language
.	O
</s>
<s>
The	O
idea	O
is	O
to	O
provide	O
a	O
more	O
rigorous	O
basis	O
for	O
exception	B-General_Concept
handling	I-General_Concept
by	O
defining	O
precisely	O
what	O
is	O
"	O
normal	O
"	O
and	O
"	O
abnormal	O
"	O
behavior	O
.	O
</s>
<s>
Exception	O
:	O
an	O
abnormal	O
event	O
occurring	O
during	O
the	O
execution	B-General_Concept
of	O
a	O
routine	O
(	O
that	O
routine	O
is	O
the	O
"	O
recipient	O
"	O
of	O
the	O
exception	O
)	O
during	O
its	O
execution	B-General_Concept
.	O
</s>
<s>
The	O
"	O
Safe	O
Exception	B-General_Concept
Handling	I-General_Concept
principle	O
"	O
as	O
introduced	O
by	O
Bertrand	O
Meyer	O
in	O
Object-Oriented	O
Software	O
Construction	O
then	O
holds	O
that	O
there	O
are	O
only	O
two	O
meaningful	O
ways	O
a	O
routine	O
can	O
react	B-Application
when	O
an	O
exception	O
occurs	O
:	O
</s>
<s>
Here	O
is	O
an	O
example	O
expressed	O
in	O
Eiffel	B-Language
syntax	O
.	O
</s>
<s>
If	O
fails	O
,	O
the	O
body	O
(	O
clause	O
)	O
will	O
be	O
executed	O
again	O
,	O
causing	O
execution	B-General_Concept
of	O
.	O
</s>
<s>
If	O
this	O
execution	B-General_Concept
of	O
fails	O
,	O
the	O
clause	O
will	O
execute	O
to	O
the	O
end	O
with	O
no	O
(	O
no	O
clause	O
in	O
the	O
final	O
)	O
,	O
causing	O
the	O
routine	O
execution	B-General_Concept
as	O
a	O
whole	O
to	O
fail	O
.	O
</s>
<s>
Although	O
exceptions	O
in	O
Eiffel	B-Language
have	O
a	O
fairly	O
clear	O
philosophy	O
,	O
Kiniry	O
(	O
2006	O
)	O
criticizes	O
their	O
implementation	O
because	O
"	O
Exceptions	O
that	O
are	O
part	O
of	O
the	O
language	O
definition	O
are	O
represented	O
by	O
INTEGER	O
values	O
,	O
developer-defined	O
exceptions	O
by	O
STRING	O
values	O
.	O
</s>
<s>
Contemporary	O
applications	O
face	O
many	O
design	O
challenges	O
when	O
considering	O
exception	B-General_Concept
handling	I-General_Concept
strategies	O
.	O
</s>
<s>
Part	O
of	O
designing	O
a	O
solid	O
exception	B-General_Concept
handling	I-General_Concept
strategy	O
is	O
recognizing	O
when	O
a	O
process	O
has	O
failed	O
to	O
the	O
point	O
where	O
it	O
cannot	O
be	O
economically	O
handled	O
by	O
the	O
software	O
portion	O
of	O
the	O
process	O
.	O
</s>
<s>
If	O
an	O
exception	O
is	O
thrown	O
and	O
not	O
caught	O
(	O
operationally	O
,	O
an	O
exception	O
is	O
thrown	O
when	O
there	O
is	O
no	O
applicable	O
handler	O
specified	O
)	O
,	O
the	O
uncaught	O
exception	O
is	O
handled	O
by	O
the	O
runtime	B-Library
;	O
the	O
routine	O
that	O
does	O
this	O
is	O
called	O
the	O
.	O
</s>
<s>
The	O
most	O
common	O
default	O
behavior	O
is	O
to	O
terminate	O
the	O
program	B-Application
and	O
print	O
an	O
error	O
message	O
to	O
the	O
console	O
,	O
usually	O
including	O
debug	O
information	O
such	O
as	O
a	O
string	O
representation	O
of	O
the	O
exception	O
and	O
the	O
stack	B-Language
trace	I-Language
.	O
</s>
<s>
This	O
is	O
often	O
avoided	O
by	O
having	O
a	O
top-level	O
(	O
application-level	O
)	O
handler	O
(	O
for	O
example	O
in	O
an	O
event	B-General_Concept
loop	I-General_Concept
)	O
that	O
catches	O
exceptions	O
before	O
they	O
reach	O
the	O
runtime	B-Library
.	O
</s>
<s>
Note	O
that	O
even	O
though	O
an	O
uncaught	O
exception	O
may	O
result	O
in	O
the	O
program	B-Application
terminating	O
abnormally	O
(	O
the	O
program	B-Application
may	O
not	O
be	O
correct	O
if	O
an	O
exception	O
is	O
not	O
caught	O
,	O
notably	O
by	O
not	O
rolling	O
back	O
partially	O
completed	O
transactions	O
,	O
or	O
not	O
releasing	O
resources	O
)	O
,	O
the	O
process	O
terminates	O
normally	O
(	O
assuming	O
the	O
runtime	B-Library
works	O
correctly	O
)	O
,	O
as	O
the	O
runtime	B-Library
(	O
which	O
is	O
controlling	O
execution	B-General_Concept
of	O
the	O
program	B-Application
)	O
can	O
ensure	O
orderly	O
shutdown	O
of	O
the	O
process	O
.	O
</s>
<s>
In	O
a	O
multithreaded	O
program	B-Application
,	O
an	O
uncaught	O
exception	O
in	O
a	O
thread	B-Operating_System
may	O
instead	O
result	O
in	O
termination	O
of	O
just	O
that	O
thread	B-Operating_System
,	O
not	O
the	O
entire	O
process	O
(	O
uncaught	O
exceptions	O
in	O
the	O
thread-level	O
handler	O
are	O
caught	O
by	O
the	O
top-level	O
handler	O
)	O
.	O
</s>
<s>
This	O
is	O
particularly	O
important	O
for	O
servers	O
,	O
where	O
for	O
example	O
a	O
servlet	B-Application
(	O
running	O
in	O
its	O
own	O
thread	B-Operating_System
)	O
can	O
be	O
terminated	O
without	O
the	O
server	O
overall	O
being	O
affected	O
.	O
</s>
<s>
This	O
default	O
uncaught	O
exception	B-General_Concept
handler	I-General_Concept
may	O
be	O
overridden	O
,	O
either	O
globally	O
or	O
per-thread	O
,	O
for	O
example	O
to	O
provide	O
alternative	O
logging	O
or	O
end-user	O
reporting	O
of	O
uncaught	O
exceptions	O
,	O
or	O
to	O
restart	O
threads	B-Operating_System
that	O
terminate	O
due	O
to	O
an	O
uncaught	O
exception	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Java	B-Language
this	O
is	O
done	O
for	O
a	O
single	B-Operating_System
thread	I-Operating_System
via	O
Thread.setUncaughtExceptionHandler	O
and	O
globally	O
via	O
Thread.setDefaultUncaughtExceptionHandler	O
;	O
in	O
Python	B-Language
this	O
is	O
done	O
by	O
modifying	O
sys.excepthook	O
.	O
</s>
<s>
Java	B-Language
introduced	O
the	O
notion	O
of	O
checked	O
exceptions	O
,	O
which	O
are	O
special	O
classes	O
of	O
exceptions	O
.	O
</s>
<s>
Failure	O
to	O
do	O
so	O
raises	O
a	O
compile-time	B-Application
error	I-Application
.	O
</s>
<s>
Checked	O
exceptions	O
can	O
,	O
at	O
compile	B-Application
time	I-Application
,	O
reduce	O
the	O
incidence	O
of	O
unhandled	B-General_Concept
exceptions	I-General_Concept
surfacing	O
at	B-Library
runtime	I-Library
in	O
a	O
given	O
application	O
.	O
</s>
<s>
Kiniry	O
writes	O
that	O
"	O
As	O
any	O
Java	B-Language
programmer	O
knows	O
,	O
the	O
volume	O
of	O
try	B-General_Concept
catch	I-General_Concept
code	O
in	O
a	O
typical	O
Java	B-Language
application	O
is	O
sometimes	O
larger	O
than	O
the	O
comparable	O
code	O
necessary	O
for	O
explicit	O
formal	O
parameter	O
and	O
return	O
value	O
checking	O
in	O
other	O
languages	O
that	O
do	O
not	O
have	O
checked	O
exceptions	O
.	O
</s>
<s>
In	O
fact	O
,	O
the	O
general	O
consensus	O
among	O
in-the-trenches	O
Java	B-Language
programmers	O
is	O
that	O
dealing	O
with	O
checked	O
exceptions	O
is	O
nearly	O
as	O
unpleasant	O
a	O
task	O
as	O
writing	O
documentation	O
.	O
</s>
<s>
Martin	O
Fowler	O
has	O
written	O
"	O
on	O
...	O
the	O
whole	O
I	O
think	O
that	O
exceptions	O
are	O
good	O
,	O
but	O
Java	B-Language
checked	O
exceptions	O
are	O
more	O
trouble	O
than	O
they	O
are	O
worth.	O
"	O
</s>
<s>
As	O
of	O
2006	O
no	O
major	O
programming	O
language	O
has	O
followed	O
Java	B-Language
in	O
adding	O
checked	O
exceptions	O
.	O
</s>
<s>
For	O
example	O
,	O
C#	B-Application
does	O
not	O
require	O
or	O
allow	O
declaration	O
of	O
any	O
exception	O
specifications	O
,	O
with	O
the	O
following	O
posted	O
by	O
Eric	O
Gunnerson	O
:	O
</s>
<s>
This	O
is	O
referred	O
to	O
as	O
catch-all	O
exception	B-General_Concept
handling	I-General_Concept
or	O
Pokémon	B-General_Concept
exception	I-General_Concept
handling	I-General_Concept
after	O
the	B-Application
show	I-Application
's	O
catchphrase	O
"	O
Gotta	O
Catch	O
‘	O
Em	O
All	O
!	O
"	O
.	O
</s>
<s>
The	O
Java	B-Language
Tutorials	O
discourage	O
catch-all	O
exception	B-General_Concept
handling	I-General_Concept
as	O
it	O
may	O
catch	O
exceptions	O
"	O
for	O
which	O
the	O
handler	O
was	O
not	O
intended	O
"	O
.	O
</s>
<s>
The	O
roots	O
of	O
checked	O
exceptions	O
go	O
back	O
to	O
the	O
CLU	B-Language
programming	I-Language
language	I-Language
's	O
notion	O
of	O
exception	O
specification	O
.	O
</s>
<s>
A	O
function	O
could	O
raise	O
only	O
exceptions	O
listed	O
in	O
its	O
type	O
,	O
but	O
any	O
leaking	O
exceptions	O
from	O
called	O
functions	O
would	O
automatically	O
be	O
turned	O
into	O
the	O
sole	O
runtime	B-General_Concept
exception	I-General_Concept
,	O
,	O
instead	O
of	O
resulting	O
in	O
compile-time	B-Application
error	I-Application
.	O
</s>
<s>
Later	O
,	O
Modula-3	B-Language
had	O
a	O
similar	O
feature	O
.	O
</s>
<s>
These	O
features	O
do	O
n't	O
include	O
the	O
compile	B-Application
time	I-Application
checking	O
that	O
is	O
central	O
in	O
the	O
concept	O
of	O
checked	O
exceptions	O
.	O
</s>
<s>
Early	O
versions	O
of	O
the	O
C++	B-Language
programming	I-Language
language	I-Language
included	O
an	O
optional	O
mechanism	O
similar	O
to	O
checked	O
exceptions	O
,	O
called	O
exception	O
specifications	O
.	O
</s>
<s>
Exception	O
specifications	O
were	O
not	O
enforced	O
at	O
compile-time	B-Application
.	O
</s>
<s>
This	O
was	O
not	O
made	O
the	O
default	O
when	O
exception	B-General_Concept
handling	I-General_Concept
was	O
added	O
to	O
the	O
language	O
because	O
it	O
would	O
have	O
required	O
too	O
much	O
modification	O
of	O
existing	O
code	O
,	O
would	O
have	O
impeded	O
interaction	O
with	O
code	O
written	O
in	O
other	O
languages	O
,	O
and	O
would	O
have	O
tempted	O
programmers	O
into	O
writing	O
too	O
many	O
handlers	O
at	O
the	O
local	O
level	O
.	O
</s>
<s>
Explicit	O
use	O
of	O
empty	O
exception	O
specifications	O
could	O
,	O
however	O
,	O
allow	O
C++	B-Language
compilers	O
to	O
perform	O
significant	O
code	O
and	O
stack	B-General_Concept
layout	O
optimizations	O
that	O
are	O
precluded	O
when	O
exception	B-General_Concept
handling	I-General_Concept
may	O
take	O
place	O
in	O
a	O
function	O
.	O
</s>
<s>
Some	O
analysts	O
viewed	O
the	O
proper	O
use	O
of	O
exception	O
specifications	O
in	O
C++	B-Language
as	O
difficult	O
to	O
achieve	O
.	O
</s>
<s>
This	O
use	O
of	O
exception	O
specifications	O
was	O
included	O
in	O
C++98	O
and	O
C++03	B-Language
,	O
deprecated	B-General_Concept
in	O
the	O
2012	O
C++	B-Language
language	I-Language
standard	O
(	O
C++11	B-Language
)	O
,	O
and	O
was	O
removed	O
from	O
the	O
language	O
in	O
C++17	B-Language
.	O
</s>
<s>
An	O
uncaught	O
exceptions	O
analyzer	O
exists	O
for	O
the	O
OCaml	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
it	O
is	O
possible	O
to	O
compile	O
and	O
run	O
a	O
program	B-Application
without	O
having	O
checked	O
the	O
exceptions	O
)	O
.	O
</s>
<s>
The	O
point	O
of	O
exception	B-General_Concept
handling	I-General_Concept
routines	O
is	O
to	O
ensure	O
that	O
the	O
code	O
can	O
handle	O
error	O
conditions	O
.	O
</s>
<s>
In	O
order	O
to	O
establish	O
that	O
exception	B-General_Concept
handling	I-General_Concept
routines	O
are	O
sufficiently	O
robust	O
,	O
it	O
is	O
necessary	O
to	O
present	O
the	O
code	O
with	O
a	O
wide	O
spectrum	O
of	O
invalid	O
or	O
unexpected	O
inputs	O
,	O
such	O
as	O
can	O
be	O
created	O
via	O
software	O
fault	O
injection	O
and	O
mutation	O
testing	O
(	O
that	O
is	O
also	O
sometimes	O
referred	O
to	O
as	O
fuzz	O
testing	O
)	O
.	O
</s>
<s>
One	O
of	O
the	O
most	O
difficult	O
types	O
of	O
software	O
for	O
which	O
to	O
write	O
exception	B-General_Concept
handling	I-General_Concept
routines	O
is	O
protocol	O
software	O
,	O
since	O
a	O
robust	O
protocol	O
implementation	O
must	O
be	O
prepared	O
to	O
receive	O
input	O
that	O
does	O
not	O
comply	O
with	O
the	O
relevant	O
specification(s )	O
.	O
</s>
<s>
In	O
order	O
to	O
ensure	O
that	O
meaningful	O
regression	O
analysis	O
can	O
be	O
conducted	O
throughout	O
a	O
software	O
development	O
lifecycle	O
process	O
,	O
any	O
exception	B-General_Concept
handling	I-General_Concept
testing	O
should	O
be	O
highly	O
automated	O
,	O
and	O
the	O
test	O
cases	O
must	O
be	O
generated	O
in	O
a	O
scientific	O
,	O
repeatable	O
fashion	O
.	O
</s>
<s>
In	O
runtime	B-Device
engine	I-Device
environments	O
such	O
as	O
Java	B-Language
or	O
.NET	B-Application
,	O
there	O
exist	O
tools	O
that	O
attach	O
to	O
the	O
runtime	B-Device
engine	I-Device
and	O
every	O
time	O
that	O
an	O
exception	O
of	O
interest	O
occurs	O
,	O
they	O
record	O
debugging	O
information	O
that	O
existed	O
in	O
memory	O
at	O
the	O
time	O
the	O
exception	O
was	O
thrown	O
(	O
call	B-General_Concept
stack	I-General_Concept
and	O
heap	B-Application
values	O
)	O
.	O
</s>
<s>
These	O
tools	O
are	O
called	O
automated	B-Language
exception	I-Language
handling	I-Language
or	O
error	O
interception	O
tools	O
and	O
provide	O
'	O
root-cause	O
'	O
information	O
for	O
exceptions	O
.	O
</s>
<s>
Asynchronous	O
exceptions	O
are	O
events	O
raised	O
by	O
a	O
separate	O
thread	B-Operating_System
or	O
external	O
process	O
,	O
such	O
as	O
pressing	O
Ctrl-C	B-Device
to	O
interrupt	B-Application
a	O
program	B-Application
,	O
receiving	O
a	O
signal	B-Operating_System
,	O
or	O
sending	O
a	O
disruptive	O
message	O
such	O
as	O
"	O
stop	O
"	O
or	O
"	O
suspend	O
"	O
from	O
another	O
thread	B-Operating_System
of	I-Operating_System
execution	I-Operating_System
.	O
</s>
<s>
It	O
follows	O
that	O
asynchronous	O
exception	B-General_Concept
handling	I-General_Concept
ca	O
n't	O
be	O
optimized	O
out	O
by	O
the	O
compiler	O
,	O
as	O
it	O
cannot	O
prove	O
the	O
absence	O
of	O
asynchronous	O
exceptions	O
.	O
</s>
<s>
They	O
are	O
also	O
difficult	O
to	O
program	B-Application
with	O
correctly	O
,	O
as	O
asynchronous	O
exceptions	O
must	O
be	O
blocked	O
during	O
cleanup	O
operations	O
to	O
avoid	O
resource	O
leaks	O
.	O
</s>
<s>
Programming	O
languages	O
typically	O
avoid	O
or	O
restrict	O
asynchronous	O
exception	B-General_Concept
handling	I-General_Concept
,	O
for	O
example	O
C++	B-Language
forbids	O
raising	O
exceptions	O
from	O
signal	B-Operating_System
handlers	I-Operating_System
,	O
and	O
Java	B-Language
has	O
deprecated	B-General_Concept
the	O
use	O
of	O
its	O
ThreadDeath	O
exception	O
that	O
was	O
used	O
to	O
allow	O
one	O
thread	B-Operating_System
to	O
stop	O
another	O
one	O
.	O
</s>
<s>
Another	O
feature	O
is	O
a	O
semi-asynchronous	O
mechanism	O
that	O
raises	O
an	O
asynchronous	O
exception	O
only	O
during	O
certain	O
operations	O
of	O
the	O
program	B-Application
.	O
</s>
<s>
For	O
example	O
Java	B-Language
's	O
only	O
affects	O
the	O
thread	B-Operating_System
when	O
the	O
thread	B-Operating_System
calls	O
an	O
operation	O
that	O
throws	O
.	O
</s>
<s>
Common	B-Language
Lisp	I-Language
,	O
Dylan	B-Language
and	O
Smalltalk	B-Application
have	O
a	O
condition	O
system	O
(	O
see	O
Common	B-Language
Lisp	I-Language
Condition	O
System	O
)	O
that	O
encompasses	O
the	O
aforementioned	O
exception	B-General_Concept
handling	I-General_Concept
systems	O
.	O
</s>
<s>
In	O
those	O
languages	O
or	O
environments	O
the	O
advent	O
of	O
a	O
condition	O
(	O
a	O
"	O
generalisation	O
of	O
an	O
error	O
"	O
according	O
to	O
Kent	O
Pitman	O
)	O
implies	O
a	O
function	O
call	O
,	O
and	O
only	O
late	O
in	O
the	O
exception	B-General_Concept
handler	I-General_Concept
the	O
decision	O
to	O
unwind	O
the	O
stack	B-General_Concept
may	O
be	O
taken	O
.	O
</s>
<s>
When	O
a	O
condition	O
arises	O
,	O
an	O
appropriate	O
condition	O
handler	O
is	O
searched	O
for	O
and	O
selected	O
,	O
in	O
stack	B-General_Concept
order	O
,	O
to	O
handle	O
the	O
condition	O
.	O
</s>
<s>
This	O
is	O
related	O
to	O
the	O
so-called	O
resumption	O
model	O
of	O
exception	B-General_Concept
handling	I-General_Concept
,	O
in	O
which	O
some	O
exceptions	O
are	O
said	O
to	O
be	O
continuable	O
:	O
it	O
is	O
permitted	O
to	O
return	O
to	O
the	O
expression	O
that	O
signaled	O
an	O
exception	O
,	O
after	O
having	O
taken	O
corrective	O
action	O
in	O
the	O
handler	O
.	O
</s>
<s>
Restarts	O
are	O
functions	O
closed	O
over	O
some	O
lexical	O
environment	O
,	O
allowing	O
the	O
programmer	O
to	O
repair	O
this	O
environment	O
before	O
exiting	O
the	O
condition	O
handler	O
completely	O
or	O
unwinding	O
the	O
stack	B-General_Concept
even	O
partially	O
.	O
</s>
<s>
An	O
example	O
is	O
the	O
ENDPAGE	O
condition	O
in	O
PL/I	B-Language
;	O
the	O
ON	O
unit	O
might	O
write	O
page	O
trailer	O
lines	O
and	O
header	O
lines	O
for	O
the	O
next	O
page	O
,	O
then	O
fall	O
through	O
to	O
resume	O
execution	B-General_Concept
of	O
the	O
interrupted	O
code	O
.	O
</s>
<s>
An	O
example	O
:	O
Suppose	O
there	O
is	O
a	O
library	O
function	O
whose	O
purpose	O
is	O
to	O
parse	O
a	O
single	O
syslog	B-Protocol
file	O
entry	O
.	O
</s>
<s>
In	O
an	O
interactive	O
log-file	O
browser	O
,	O
the	O
right	O
thing	O
to	O
do	O
might	O
be	O
to	O
return	O
the	O
entry	O
unparsed	O
,	O
so	O
the	O
user	O
can	O
see	O
it	O
—	O
but	O
in	O
an	O
automated	O
log-summarizing	O
program	B-Application
,	O
the	O
right	O
thing	O
to	O
do	O
might	O
be	O
to	O
supply	O
null	O
values	O
for	O
the	O
unreadable	O
fields	O
,	O
but	O
abort	O
with	O
an	O
error	O
,	O
if	O
too	O
many	O
entries	O
have	O
been	O
malformed	O
.	O
</s>
<s>
That	O
is	O
to	O
say	O
,	O
the	O
question	O
can	O
only	O
be	O
answered	O
in	O
terms	O
of	O
the	O
broader	O
goals	O
of	O
the	O
program	B-Application
,	O
which	O
are	O
not	O
known	O
to	O
the	O
general-purpose	O
library	O
function	O
.	O
</s>
<s>
So	O
instead	O
of	O
simply	O
exiting	O
with	O
an	O
error	O
,	O
the	O
function	O
may	O
establish	O
restarts	O
offering	O
various	O
ways	O
to	O
continue	O
—	O
for	O
instance	O
,	O
to	O
skip	O
the	O
log	O
entry	O
,	O
to	O
supply	O
default	O
or	O
null	O
values	O
for	O
the	O
unreadable	O
fields	O
,	O
to	O
ask	O
the	O
user	O
for	O
the	O
missing	O
values	O
,	O
or	O
to	O
unwind	O
the	O
stack	B-General_Concept
and	O
abort	O
processing	O
with	O
an	O
error	O
message	O
.	O
</s>
<s>
Exception	B-General_Concept
handling	I-General_Concept
is	O
often	O
not	O
handled	O
correctly	O
in	O
software	O
,	O
especially	O
when	O
there	O
are	O
multiple	O
sources	O
of	O
exceptions	O
;	O
data	O
flow	O
analysis	O
of	O
5	O
million	O
lines	O
of	O
Java	B-Language
code	I-Language
found	O
over	O
1300	O
exception	B-General_Concept
handling	I-General_Concept
defects	O
.	O
</s>
<s>
"	O
While	O
try-catch-finally	O
is	O
conceptually	O
simple	O
,	O
it	O
has	O
the	O
most	O
complicated	O
execution	B-General_Concept
description	O
in	O
the	O
language	O
specification	O
[	O
Gosling	O
et	O
al	O
.	O
</s>
<s>
Exceptions	O
,	O
as	O
unstructured	O
flow	O
,	O
increase	O
the	O
risk	O
of	O
resource	O
leaks	O
(	O
such	O
as	O
escaping	O
a	O
section	O
locked	O
by	O
a	O
mutex	B-Operating_System
,	O
or	O
one	O
temporarily	O
holding	O
a	O
file	O
open	O
)	O
or	O
inconsistent	O
state	O
.	O
</s>
<s>
There	O
are	O
various	O
techniques	O
for	O
resource	O
management	O
in	O
the	O
presence	O
of	O
exceptions	O
,	O
most	O
commonly	O
combining	O
the	O
dispose	B-Application
pattern	I-Application
with	O
some	O
form	O
of	O
unwind	O
protection	O
(	O
like	O
a	O
finally	O
clause	O
)	O
,	O
which	O
automatically	O
releases	O
the	O
resource	O
when	O
control	O
exits	O
a	O
section	O
of	O
code	O
.	O
</s>
<s>
Tony	O
Hoare	O
in	O
1980	O
described	O
the	O
Ada	B-Language
programming	I-Language
language	I-Language
as	O
having	O
"	O
a	O
...	O
plethora	O
of	O
features	O
and	O
notational	O
conventions	O
,	O
many	O
of	O
them	O
unnecessary	O
and	O
some	O
of	O
them	O
,	O
like	O
exception	B-General_Concept
handling	I-General_Concept
,	O
even	O
dangerous	O
.	O
</s>
<s>
Front-end	O
web	O
frameworks	O
,	O
such	O
as	O
React	B-Application
and	O
Vue	B-Language
,	O
have	O
introduced	O
error	B-General_Concept
handling	I-General_Concept
mechanisms	O
where	O
errors	O
propagate	O
up	O
the	O
UI	O
component	O
hierarchy	O
,	O
in	O
a	O
way	O
that	O
is	O
analogous	O
to	O
how	O
errors	O
propagate	O
up	O
the	O
call	B-General_Concept
stack	I-General_Concept
in	O
executing	O
code	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Vue	B-Language
,	O
a	O
component	O
would	O
catch	O
errors	O
by	O
implementing	O
errorCapturedWhen	O
used	O
like	O
this	O
in	O
markup:The	O
error	O
produced	O
by	O
the	O
child	O
component	O
is	O
caught	O
and	O
handled	O
by	O
the	O
parent	O
component	O
.	O
</s>
