Errors

An error is a value: try catches one and gives it, cause-error makes one happen. catch and throw leave a block from deep inside it, which is not an error at all. See errors.

try

Evaluates a block; gives an error as a value instead of raising it.

try body
  • body (block!)

attempt

Evaluates a block; gives none if it raises an error.

attempt body
  • body (block!)

catch

Evaluates a block; gives the value a throw inside it threw.

catch body
  • body (block!)

  • /name word (word! block!)

throw

Throws a value to the catch around it.

throw value
  • value (any-value!)

  • /name word (word!)

cause-error

Raises an error of a type and an id.

cause-error type id args
  • type (word!)

  • id (word!)

  • args (any-value!)

loaded-at

Where the value at the position of a block was loaded from, as file:line:col; none if it was made at run time.

loaded-at block
  • block (any-block!)

The place an error’s At names, for any value of a block: a dialect uses it to say where a problem in the block it reads is. A block made by code (append, compose, reduce) has no place for what was put in it.

>> loaded-at next [bike saddle]
== "1:22"