Skip to main content

exception

Function exception 

Source
pub fn exception(out: &mut CodeValue, source: &str, message: &str)
Expand description

Build Exception { source, message, innerException } into out — how a module reports that it could not do the work.

This is the only way a module should fail. A module may never end the application (docs/todo/errors-as-particles.md): the program receives this as an ordinary value through get, and may test it with is Exception, read message, or ignore it entirely.

source names the module, which a returned value cannot otherwise be asked — the caller knows what it emitted to, but an Exception stored, passed on, or wrapped as another’s innerException has lost that.

innerException is null here; use exception_wrapping to carry the failure underneath this one.