Le ven. 3 juil. 2020 à 16:23, Romain Beauxis <[email protected]> a
écrit :
> Exceptions
>
> You can now throw and catch exceptions. The syntax is as follows:
I got a little bit carried over here haha. The correct syntax for error
catching and throwing is:
err = error.register("My Error")
# Catch only our error and another one:
try
.. some code ..
# On error:
error.raise(err, "foo")
catch e in [err, err2] do
message = error.message(e) ?? "no message"
print("error: #{message}")
end
# Catch all errors:
try
.. some code ..
catch e do
message = error.message(e) ?? "no message"
print("error: #{message}")
end
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users