Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
Cloud & Deployment
Core Language & Structure
Data Manipulation & Analysis
Engineering Data & Computation
External Interfaces & Connections
Financial Data & Computation
Geographic Data & Computation
Geometry
Graphs & Networks
Higher Mathematical Computation
Images
Knowledge Representation & Natural Language
Machine Learning
Notebook Documents & Presentation
Scientific and Medical Data & Computation
Social, Cultural & Linguistic Data
Strings & Text
Symbolic & Numeric Computation
System Operation & Setup
Time-Related Computation
User Interface Construction
Visualization & Graphics
Random Paclet
Alphabetical List
Using Paclets
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
ErrorTools
Guides
ErrorTools
Tech Notes
Error Handling with ErrorTools
Symbols
Raise
ErrorTools
The new error handling functionality in this paclet is centered around quality of life improvements to
F
a
i
l
u
r
e
[
…
]
and the addition of new functions that construct, throw, and catch
F
a
i
l
u
r
e
[
…
]
objects.
Failure Error Tags
C
r
e
a
t
e
E
r
r
o
r
T
y
p
e
— register a new error tag usable with
C
r
e
a
t
e
F
a
i
l
u
r
e
,
R
a
i
s
e
, and
H
a
n
d
l
e
C
r
e
a
t
e
F
a
i
l
u
r
e
— construct a new
F
a
i
l
u
r
e
[
…
]
with the specified error tag and formatted message
Raising and Handling Failure Exceptions
R
a
i
s
e
and
H
a
n
d
l
e
are analogous to
T
h
r
o
w
and
C
a
t
c
h
, but they assume that the thrown "payload" is always a
F
a
i
l
u
r
e
[
…
]
object.
H
a
n
d
l
e
supports conditional catching of throw
F
a
i
l
u
r
e
's by pattern matching.
R
a
i
s
e
— construct and throw a
F
a
i
l
u
r
e
[
…
]
with the specified error tag and formatted message
H
a
n
d
l
e
— catch raised
F
a
i
l
u
r
e
[
…
]
's that match the specified error tag
F
a
i
l
u
r
e
P
a
t
t
e
r
n
— pattern that matches any
F
a
i
l
u
r
e
containing the specified tag
Logic Error Checking Utilities
Utilities for failing fast and informatively when a program state was reached that the programmer didn't intend or anticipate. These utilities should not be used to raise errors that are expected by the programmer.
R
a
i
s
e
A
s
s
e
r
t
— raise a
F
a
i
l
u
r
e
[
A
s
s
e
r
t
F
a
i
l
e
d
E
r
r
o
r
,
…
]
if the specified condition is not true, with an optional custom error message
C
o
n
f
i
r
m
R
e
p
l
a
c
e
— apply a rule or list of rules in an attempt to transform the specified expr, raising a
F
a
i
l
u
r
e
[
C
o
n
f
i
r
m
R
e
p
l
a
c
e
E
r
r
o
r
,
…
]
if no rule matches
S
e
t
F
a
l
l
t
h
r
o
u
g
h
E
r
r
o
r
— set a "fallthrough" down value on the specified symbol that raises a
F
a
i
l
u
r
e
[
D
o
w
n
V
a
l
u
e
F
a
l
l
t
h
r
o
u
g
h
E
r
r
o
r
,
…
]
if no other down values match
Error Propagation & Composition
R
a
i
s
e
C
o
n
f
i
r
m
— if the argument expression is a Failure, raise it, otherwise return it
W
r
a
p
F
a
i
l
u
r
e
— wraps an existing
F
a
i
l
u
r
e
in a new
F
a
i
l
u
r
e
with the specified error tag and formatted message, and with a
"
C
a
u
s
e
d
B
y
"
o
r
i
g
F
a
i
l
u
r
e
field
W
r
a
p
R
a
i
s
e
d
— wrap an uncaught raised
F
a
i
l
u
r
e
in a new
F
a
i
l
u
r
e
with the specified error tag and formatted message, and with a
"
C
a
u
s
e
d
B
y
"
o
r
i
g
F
a
i
l
u
r
e
field
Built-In Error Types
A
s
s
e
r
t
F
a
i
l
e
d
E
r
r
o
r
— error tag raised by
R
a
i
s
e
A
s
s
e
r
t
D
o
w
n
V
a
l
u
e
F
a
l
l
t
h
r
o
u
g
h
E
r
r
o
r
— error tag raised by
S
e
t
F
a
l
l
t
h
r
o
u
g
h
E
r
r
o
r
functions on fallthrough
C
o
n
f
i
r
m
R
e
p
l
a
c
e
E
r
r
o
r
— error tag raised by
C
o
n
f
i
r
m
R
e
p
l
a
c
e
T
e
c
h
N
o
t
e
s
▪
E
r
r
o
r
H
a
n
d
l
i
n
g
W
i
t
h
E
r
r
o
r
T
o
o
l
s
"
"