Mod of exceptions.
3.7.1. type exception¶
An exception is a pair of a message str and a vec of traces.
An exception can also have the `next` exception in the chain. Exception chain is used for “suppressed” exceptions by CONTROL.with_finally. It is not for exception wrapping.
`message` returns the exception message str.
`traces` returns a the exception traces. The result is a vec of traces, The traces are indexed from the root to the top.
`have_next?` returns whether `Exception` has the next exception in the chain.
`next` returns the next exception in the chain.
• `Exception` must have the next exception in the chain.
`raise` raises an exception.
At the tail of `raise`, the following sequence of abstract instructions is evaluated:
(val Exception) (raise)
`op_add` concatenates the chain of `Exception` and the chain of `Tail`, and returns an exception of the new chain.
• `Tail` must be an exception.
• The resutl is an exception.
`desc_iter` returns an iter of lines describing the exception.
Each element of the iter is a str, which does NOT end with newline.
`op_eq` returns whether the two exceptions are equal.
They are equal in either of the following conditions:
• Both exceptions don't have the next exception in the chain, the message strs are equal, and the vecs of traces are equal.
• Both exceptions have the next exception in the chain, the next exceptions are equal, the message strs are equal, and the vecs of traces are equal.
3.7.2. EXCEPTION.new(Message Traces)¶
`new` makes an exception val.
• `Message` must be a str
• `Traces` must be a vec of traces
Whether `Val` is an exception.