Exception: RedisPrescription::ScriptError

Inherits:
Error
  • Object
show all
Defined in:
lib/redis_prescription/errors.rb

Overview

Lua script eval/evalsha failure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, source) ⇒ ScriptError

Returns a new instance of ScriptError.

Parameters:

  • message (String)
  • source (#to_s)


52
53
54
55
56
57
58
59
60
61
# File 'lib/redis_prescription/errors.rb', line 52

def initialize(message, source)
  @source = -source.to_s

  if (parsed = LUA_ERROR_MESSAGE.match(message))
    @loc    = parsed[:loc].to_i
    message = [parsed[:message], excerpt(@source, @loc)].compact.join("\n\n")
  end

  super(message)
end

Instance Attribute Details

#locInteger? (readonly)

Line of code where error was encountered

Returns:

  • (Integer?)


48
49
50
# File 'lib/redis_prescription/errors.rb', line 48

def loc
  @loc
end

#sourceString (readonly)

Lua script source

Returns:

  • (String)


43
44
45
# File 'lib/redis_prescription/errors.rb', line 43

def source
  @source
end