class Novika::Error

Overview

Holds and accepts information about an error.

Errors are raised when a certain case is undesired, unhandleable, or otherwise inappropriate to some form of computation.

Errors can be handled and unhandled. Unhandled errors generate an error #report (generally to STDERR, but this depends on the frontend). They are fatal for the program they occur in.

Death handlers, or death traps, when set up in code blocks and/or their relatives, allow errors to be handled. For this reason, errors are Novika Forms, and can be manipulated, reported, and inspected from Novika.

Included Modules

Defined in:

novika/error.cr

Constant Summary

MAX_TRACE = 64

How many trace entries to display at max.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Novika::Form

a(type : T.class) : T forall T a, desc(io : IO)
desc : String
desc
, die(details : String) die, effect(io)
effect
effect
, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote

Instance methods inherited from module Novika::Schedulable

schedule(engine : Engine, stack : Block) schedule, schedule!(engine : Engine, stack : Block) schedule!

Constructor Detail

def self.new(details : String, form : Novika::Form | Nil = nil) #

Class Method Detail

def self.typedesc #

Instance Method Detail

def conts : Block | Nil #

Holds a reference to the continuations block at the time of death.


def conts=(conts : Block | Nil) #

Holds a reference to the continuations block at the time of death.


def desc(io : IO) #
Description copied from module Novika::Form

Appends a string description of this form to io.


def details : String #

Returns a string describing the reasons of this error.


def form : Form #

Returns the form that (speculatively) caused this error.


def form? : Form | Nil #

Returns the form that (speculatively) caused this error.


def report(io : IO) #

Reports about this error to io.

Note: Colorize is used for colors and emphasis. If you do not want Colorize in io, you can temporarily disable it by setting Colorize.enabled = false.


def to_s(io) #