Next: 2.10.2 envdict Up: 2.10 Dictionary reference Previous: 2.10 Dictionary reference Contents Index

##
2.10.1 currenterror

Each thread has its own currenterror dictionary, which is used by the error handling machinery to store error state.

Table 2.5: currenterror summary
Input(s) Op/Proc/Var Output(s) | Description
- newerror boolean | Set to true during error handling.
- errorname name | Name of most recent error.
- line number | Get line number of syntax error.
- column number | Get column number of syntax error.
- ostack stack | ostack snapshot.
- dstack stack | dstack snaphot.
- estack stack | estack snapshot.
- istack stack | istack snapshot.

- column integer:
  Input(s):
    None.
  Output(s):
    integer:
      Column number, valid only if the error was a syntaxerror. Column numbering starts at 0.
  Errors(s):
    None.
  Description:
    Get the column number that a syntaxerror occurred on.
  Example(s):

        onyx:0> `1 2 3}' cvx eval
        At line 1, column 5: Error $syntaxerror
        ostack: (1 2 3 `}')
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..3):
        0:      `1 2 3}'
        1:      --eval--
        2:      -file-
        3:      --start--
        onyx:5> currenterror $column get 1 sprint
        5
        onyx:5>

- dstack stack:
  Input(s):
    None.
  Output(s):
    stack:
      A dstack snapshot.
  Errors(s):
    None.
  Description:
    Get a stack that is a dstack snapshot as of the most recent error.
  Example(s):

        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> currenterror begin dstack end 1 sprint
        (-dict- -dict- -dict- -dict-)
        onyx:1>

- errorname name:
  Input(s):
    None.
  Output(s):
    name:
      Name of the most recent error.
  Errors(s):
    None.
  Description:
    Get the name of the most recent error.
  Example(s):

        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> currenterror begin errorname end 1 sprint
        $undefined
        onyx:1>

- estack stack:
  Input(s):
    None.
  Output(s):
    stack:
      An estack snapshot.
  Errors(s):
    None.
  Description:
    Get a stack that is an estack snapshot as of the most recent error.
  Example(s):

        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> currenterror begin estack end 1 sprint
        (--start-- -file- x)
        onyx:1>

- istack stack:
  Input(s):
    None.
  Output(s):
    stack:
      An istack snapshot.
  Errors(s):
    None.
  Description:
    Get a stack that is an istack snapshot as of the most recent error.
  Example(s):

        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> currenterror begin istack end 1 sprint
        (0 0 0)
        onyx:1>

- newerror boolean:
  Input(s):
    None.
  Output(s):
    boolean:
      False if there has been no error since the last time newerror was reset; true otherwise.
  Errors(s):
    None.
  Description:
    Get a boolean that represents whether there has been an error since the last time newerror was set to false (as during interpreter initialization). It is the application's responsibility to reset newerror after each error if it expects the value to be useful across multiple errors.
  Example(s):

        onyx:0> currenterror begin
        onyx:0> newerror 1 sprint
        false
        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> newerror 1 sprint
        true
        onyx:1> $newerror false def
        onyx:1> newerror 1 sprint
        false
        onyx:1> resume
        onyx:1> y
        Error $undefined
        ostack: (x)
        dstack: (-dict- -dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      y
        1:      -file-
        2:      --start--
        onyx:2> newerror 1 sprint
        true
        onyx:2>

- line integer:
  Input(s):
    None.
  Output(s):
    integer:
      Line number, valid only if the error was a syntaxerror. Line numbering starts at 1.
  Errors(s):
    None.
  Description:
    Get the line number that a syntaxerror occurred on.
  Example(s):

        onyx:0> `1 2 3}' cvx eval
        At line 1, column 5: Error $syntaxerror
        ostack: (1 2 3 `}')
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..3):
        0:      `1 2 3}'
        1:      --eval--
        2:      -file-
        3:      --start--
        onyx:5> currenterror $line get 1 sprint
        1
        onyx:5>

- ostack stack:
  Input(s):
    None.
  Output(s):
    stack:
      An ostack snapshot.
  Errors(s):
    None.
  Description:
    Get a stack that is an ostack snapshot as of the most recent error.
  Example(s):

        onyx:0> x
        Error $undefined
        ostack: ()
        dstack: (-dict- -dict- -dict- -dict-)
        estack/istack trace (0..2):
        0:      x
        1:      -file-
        2:      --start--
        onyx:1> currenterror begin ostack end 1 sprint
        ()
        onyx:1>

Next: 2.10.2 envdict Up: 2.10 Dictionary reference Previous: 2.10 Dictionary reference Contents Index