module error - jeffmanzione/zinnia GitHub Wiki

module error


class Error

Represents a run-time error: an unexpected program state that can be caught programmatically with a try {} catch e {} clause.

  • Error(msg): Creates a new Error with message [msg].


Example 1: Raising an error.

if ~x {
  raise error.Error('Very important x is unexpectedly None.')

Example 2: Catching and handling an error.

try {
catch e {
   io.println('Haha, None has no members!')