Historia wymaga pasterzy, nie rzeźników.

..)
{
/
/ cleanup, if possible and necessary
e
er
rr
rn
no
o = E
E _
_ C
CP
PL
LP
PL
LF
FC
CT
TB
BL
LE
EW
WI
IT
T;
}
}
In such cases, it is important to be systematic enough to ensure that the conversion of error reporting styles is complete.
Error handling should be – as far as possible – hierarchical. If a function detects a run-time error, it should not ask its caller for help with recovery or resource acquisition. Such requests set up cycles in the system dependencies. That in turn makes the program hard to understand and introduces the possibility of infinite loops in the error-handling and recovery code.
Simplifying techniques such as ‘‘resource acquisition is initialization’’ and simplifying assumptions such as ‘‘exceptions represent errors’’ should be used to make the error-handling code more regular. See also §24.3.7.1 for ideas about how to use invariants and assertions to make the trigger-ing of exceptions more regular.
14.10 Standard
Exceptions [except.std]
Here is a table of standard exceptions and the functions, operators, and general facilities that throw them:
_________________________________________________________________

Standard Exceptions (thrown by the language)
_________________________________________________________________


Name Thrown
by
Reference
Header
_________________________________________________________________


 b
ba
ad
d _
_ a
al
ll
lo
oc
c
new
§6.2.6.2, §19.4.5
<new>

 b
ba
ad
d _
_ c
ca
as
st
t
dynamic _ cast
§15.4.1.1
<typeinfo> 


b
ba
ad
d _
_ t ty
yp
pe
ei
id
d
typeid
§15.4.4
<typeinfo>


b
ba
ad
d _
_ e
ex
xc
ce
ep
pt
ti
io
on
n
exception specification
§14.6.3
<exception>
_________________________________________________________________


The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
Section 14.10
Standard Exceptions
385
_ ________________________________________________________________________
_

Standard Exceptions (thrown by the standard library)
________________________________________________________________________
_



Name Thrown
by
Reference Header
_
________________________________________________________________________


 o
ou
ut
t _
_ o
of
f _
_ r
ra
an
ng
ge
e
at()
§3.7.2, §16.3.3, §20.3.3
<stdexcept> 

bitset<> ::operator[]()
§17.5.3
<stdexcept> 


i
in
nv
va
al
li
id
d _
_ a
ar
rg
gu
um
me
en
nt
t
bitset constructor
§17.5.3.1
<stdexcept>


o
ov
ve
er
rf
fl
lo
ow
w _
_ e
er
rr
ro
or
r
bitset<> ::to _ ulong()
§17.5.3.3
<stdexcept>


i
io
os
s
_ _
_ b
ba
as
se
e:
::
:f
fa
ai
il
lu
ur
re
e
ios _ base::clear()
§21.3.6
<ios>
________________________________________________________________________


The library exceptions are part of a class hierarchy rooted in the standard library exception class e
ex
xc
ce
ep
pt
ti
io
on
n presented in < e
ex
xc
ce
ep
pt
ti
io
on
n>:
c
cl
la
as
ss
s e
ex
xc
ce
ep
pt
ti
io
on
n {
p
pu
ub
bl
li
ic
c:
e
ex
xc
ce
ep
pt
ti
io
on
n() t
th
hr
ro
ow
w()
;
e
ex
xc
ce
ep
pt
ti
io
on
n( c
co
on
ns
st
t e
ex
xc
ce
ep
pt
ti
io
on
n&) t
th
hr
ro
ow
w()
;
e
ex
xc
ce
ep
pt
ti
io
on
n& o
op
pe
er
ra
at
to
or
r=( c
co
on
ns
st
t e
ex
xc
ce
ep
pt
ti
io
on
n&) t
th
hr
ro
ow
w()
;
v
vi
ir
rt
tu
ua
al
l ~ e
ex
xc
ce
ep
pt
ti
io
on
n() t
th
hr
ro
ow
w()
;
v
vi
ir
rt
tu
ua
al
l c
co
on
ns
st
t c
ch
ha
ar
r* w
wh
ha
at
t() c
co
on
ns
st
t t
th
hr
ro
ow
w()
;
p
pr
ri
iv
va
at
te
e:
/
/ ...
};
The hierarchy looks like this:
e
ex
xc
ce
ep
pt
ti
io
on
n
.
l
lo
og
gi
ic
c _
_ e
er
rr
ro
or
r r
ru
un
nt
ti
im
me
e _
_ e
er
rr
ro
or
r
l
le
en
ng
gt
th
h _
_ e
er
rr
ro
or
r
r
ra
an
ng
ge
e _
_ e
er
rr
ro
or
r
d
do
om
ma
ai
in
n _
_ e
er
rr
ro
or
r
b
ba
ad
d _
_ a
al
ll
lo
oc
c
o
b ov
ba ve
er
ad
d
rf
_
_
fl
c lo
ow
ca
as w
st
t
_
_ e
er
rr
ro
or
r
o
ou
ut
t _
_ o
of
f _
_ r
ra
an
ng
ge
e
b
ba
ad
d _
_ e
ex
xc
ce
ep
pt
ti
io
on
n
b u
un
ba nd
ad
d
de
_
_
er
t rf
ty fl
yp lo
ow
pe
ei w
id
d
_
_ e
er
rr
ro
or
r
i
in
nv
va
al
li
id
d _
_ a
ar
rg
gu
um
me
en
nt
t
i
io
os
s _
_ b
ba
as
se
e:
::
:f
fa
ai
il
lu
ur
re
e

Podstrony