forked from ground/ground
Catching errors across scopes
This commit is contained in:
@@ -1 +1,23 @@
|
||||
error "Hello, world!" "sillyError"
|
||||
fun -int !divten -int &divisor
|
||||
divide 10 $divisor &out
|
||||
# Skip the rest of the function because we have an error
|
||||
println "aw yeag we devided by zero"
|
||||
return $out
|
||||
endfun
|
||||
|
||||
fun -string !wrapperFn -int &dingle
|
||||
pusharg $dingle
|
||||
!divten &result
|
||||
# Skip the rest of the function because we have an error
|
||||
println "big error incoming"
|
||||
tostring $result &out
|
||||
return $out
|
||||
endfun
|
||||
|
||||
catch "divisionByZeroError" &success
|
||||
pusharg 0
|
||||
!wrapperFn &result
|
||||
|
||||
# There's a catch in this scope, stop here and continue execution
|
||||
|
||||
println $success
|
||||
|
||||
Reference in New Issue
Block a user