Exception: Wolverine::LuaError
- Inherits:
-
StandardError
- Object
- StandardError
- Wolverine::LuaError
- Defined in:
- lib/wolverine/lua_error.rb
Overview
Reformats errors raised by redis representing failures while executing a lua script. The default errors have confusing messages and backtraces, and a type of RuntimeError
. This class improves the message and modifies the backtrace to include the lua script itself in a reasonable way.
Constant Summary collapse
- PATTERN =
/ERR Error (compiling|running) script \(.*?\): .*?:(\d+): (.*)/
- WOLVERINE_LIB_PATH =
File.('../../', __FILE__)
Class Method Summary collapse
-
.intercepts?(error) ⇒ Boolean
Is this error one that should be reformatted?.
Instance Method Summary collapse
-
#initialize(error, file) ⇒ LuaError
constructor
Initialize a new LuaError from an existing redis error, adjusting the message and backtrace in the process.
Constructor Details
#initialize(error, file) ⇒ LuaError
Initialize a new Wolverine::LuaError from an existing redis error, adjusting the message and backtrace in the process.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wolverine/lua_error.rb', line 24 def initialize error, file @error = error @file = file @error. =~ PATTERN stage, line_number, = $1, $2, $3 super set_backtrace generate_backtrace file, line_number end |
Class Method Details
.intercepts?(error) ⇒ Boolean
Is this error one that should be reformatted?
15 16 17 |
# File 'lib/wolverine/lua_error.rb', line 15 def self.intercepts? error error. =~ PATTERN end |