blob: 518c1f11b652f0f4836f507ab2214e53714a705d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
Wrapping an exeptional operation in try {} catch {} allows handling the
resulting exception and to continue the execution flow.
-- Expect stdout --
Catched first exception.
Catched second exception: exception 2.
After exceptions.
-- End --
-- Testcase --
{%
// A try-catch block that discards the exception information.
try {
die("exception 1");
}
catch {
print("Catched first exception.\n");
}
// A try-catch block that captures the resulting exception in
// the given variable.
try {
die("exception 2");
}
catch (e) {
print("Catched second exception: ", e, ".\n");
}
print("After exceptions.\n");
%}
-- End --
|