refs #22 docs reordered chapters

This commit is contained in:
Sergey Chernov 2025-06-13 01:45:33 +04:00
parent 88974e0f2d
commit aea819b89a

View File

@ -81,6 +81,22 @@ to catch all exceptions to, then you can write it even shorter:
You can even check the type of the `it` and create more convenient and sophisticated processing logic. Such approach is
used, for example, in Scala.
## finally block
If `finally` block present, it will be executed after body (until first exception)
and catch block, if any will match. finally statement is executed even if the
exception will be thrown and not caught locally. It does not alter try/catch block result:
try {
}
finally {
println("called finally")
}
>>> called finally
>>> void
- and yes, there could be try-finally block, no catching, but perform some guaranteed cleanup.
# Conveying data with exceptions
The simplest way is to provide exception string and `Exception` class:
@ -106,22 +122,6 @@ This way, in turn, can also be shortened, as it is overly popular:
The trick, though, works with strings only, and always provide `Exception` instances, which is good for debugging but
most often not enough.
## finally block
If `finally` block present, it will be executed after body (until first exception)
and catch block, if any will match. finally statement is executed even if the
exception will be thrown and not caught locally. It does not alter try/catch block result:
try {
}
finally {
println("called finally")
}
>>> called finally
>>> void
- and yes, there could be try-finally block, no catching, but perform some guaranteed cleanup.
# Custom error classes
_this functionality is not yet released_