Exception: Teek::TclError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/teek.rb,
ext/teek/tcltkbridge.c

Overview

Raised on a Tcl error (TCL_ERROR) from #tcl_eval, #tcl_invoke, or anything built on them. message is the same short one-line Tcl result this exception has always carried; #tcl_backtrace and #tcl_error_code additionally expose Tcl's own +errorInfo+/+errorCode+ for the failing call - captured immediately after the failing Tcl_Eval/Tcl_EvalObjv via Tcl_GetReturnOptions, before anything else can run and disturb them. Both are nil for the handful of Ruby-level guard errors (e.g. "interpreter has been deleted") that never actually reached Tcl.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, tcl_backtrace = nil, tcl_error_code = nil) ⇒ TclError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TclError.



61
62
63
64
65
# File 'lib/teek.rb', line 61

def initialize(message, tcl_backtrace = nil, tcl_error_code = nil)
  super(message)
  @tcl_backtrace = tcl_backtrace
  @tcl_error_code = tcl_error_code
end

Instance Attribute Details

#tcl_backtraceString? (readonly)

Returns Tcl's errorInfo for the failing call - a multi-line trace with a "while executing"/"invoked from within" frame for each level of Tcl proc call the error unwound through.

Returns:

  • (String, nil)

    Tcl's errorInfo for the failing call - a multi-line trace with a "while executing"/"invoked from within" frame for each level of Tcl proc call the error unwound through



54
55
56
# File 'lib/teek.rb', line 54

def tcl_backtrace
  @tcl_backtrace
end

#tcl_error_codeString? (readonly)

Returns Tcl's errorCode for the failing call (a Tcl list, typically "NONE" unless the failing command set one explicitly).

Returns:

  • (String, nil)

    Tcl's errorCode for the failing call (a Tcl list, typically "NONE" unless the failing command set one explicitly)



58
59
60
# File 'lib/teek.rb', line 58

def tcl_error_code
  @tcl_error_code
end