Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -2,6 +2,7 @@
|
|||
{{omit from|Euphoria}}
|
||||
{{omit from|M4}}
|
||||
{{omit from|Retro}}
|
||||
[[Category:Flow control]]
|
||||
|
||||
This task is to give an example of an exception handling routine
|
||||
and to "throw" a new exception.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ T SillyError
|
|||
.message = message
|
||||
|
||||
X.try
|
||||
X SillyError(‘egg’)
|
||||
X.throw SillyError(‘egg’)
|
||||
X.catch SillyError se
|
||||
print(se.message)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# do something
|
||||
throw "not a math exception"
|
||||
|
||||
catch .e {
|
||||
if .e["cat"] == "math" {
|
||||
catch[.e] {
|
||||
if .e'cat == "math" {
|
||||
# change result...
|
||||
} else {
|
||||
# rethrow the exception
|
||||
|
|
@ -10,5 +9,4 @@ catch .e {
|
|||
}
|
||||
} else {
|
||||
# no exception
|
||||
...
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
100 / 0
|
||||
|
||||
catch {
|
||||
if _err["cat"] == "math" {
|
||||
if _err'cat == "math" {
|
||||
# change result
|
||||
123
|
||||
} else {
|
||||
# rethrow the exception
|
||||
throw
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
val .safediv = f { .x / .y ; catch { 0 } }
|
||||
val .safediv = fn(.x, .y) { .x / .y ; catch : 0 }
|
||||
.safediv(7, 7) # 1
|
||||
.safediv(7, 0) # 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue