Exception: Rufus::Lua::LuaError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Rufus::Lua::LuaError
- Defined in:
- lib/rufus/lua/error.rb
Overview
An error class for rufus-lua.
Constant Summary collapse
- CALLER_REX =
/^(.+):(\d+):/
- DIR =
File.dirname(__FILE__)
Instance Attribute Summary collapse
-
#bndng ⇒ Object
readonly
Returns the value of attribute bndng.
-
#errcode ⇒ Object
readonly
Returns the value of attribute errcode.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#original_backtrace ⇒ Object
readonly
Returns the value of attribute original_backtrace.
Instance Method Summary collapse
-
#initialize(kind, errcode, msg, bndng, filename, lineno) ⇒ LuaError
constructor
A new instance of LuaError.
- #set_backtrace(trace) ⇒ Object
Constructor Details
#initialize(kind, errcode, msg, bndng, filename, lineno) ⇒ LuaError
Returns a new instance of LuaError.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rufus/lua/error.rb', line 18 def initialize(kind, errcode, msg, bndng, filename, lineno) super("#{kind} : '#{msg}' (#{errcode} #{LUA_ERRS[errcode]})") @kind = kind @errcode = errcode @msg = msg @bndng = bndng @filename = filename @lineno = lineno end |
Instance Attribute Details
#bndng ⇒ Object (readonly)
Returns the value of attribute bndng.
14 15 16 |
# File 'lib/rufus/lua/error.rb', line 14 def bndng @bndng end |
#errcode ⇒ Object (readonly)
Returns the value of attribute errcode.
13 14 15 |
# File 'lib/rufus/lua/error.rb', line 13 def errcode @errcode end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
14 15 16 |
# File 'lib/rufus/lua/error.rb', line 14 def filename @filename end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
13 14 15 |
# File 'lib/rufus/lua/error.rb', line 13 def kind @kind end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
14 15 16 |
# File 'lib/rufus/lua/error.rb', line 14 def lineno @lineno end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
13 14 15 |
# File 'lib/rufus/lua/error.rb', line 13 def msg @msg end |
#original_backtrace ⇒ Object (readonly)
Returns the value of attribute original_backtrace.
16 17 18 |
# File 'lib/rufus/lua/error.rb', line 16 def original_backtrace @original_backtrace end |
Instance Method Details
#set_backtrace(trace) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rufus/lua/error.rb', line 47 def set_backtrace(trace) @original_backtrace = trace trace = trace.select { |line| m = CALLER_REX.match(line) ( ! m) || File.dirname(m[1]) != DIR } trace.insert(0, "#{@filename}:#{@lineno}:") if @filename super(trace) end |