Catching errors across scopes

This commit is contained in:
2025-09-21 14:10:09 +10:00
parent bfbcd376df
commit c4ebca9ed9
2 changed files with 45 additions and 1 deletions

View File

@@ -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