Exception: Rmega::Errors::ServerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rmega/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, opts = {}) ⇒ ServerError

Returns a new instance of ServerError.



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rmega/errors.rb', line 34

def initialize(value, opts = {})
  if msg = Errors::CODES[value.to_i]
    @code = value.to_i
    @message = msg || "Error code #{@code}"
  else
    @message = value
  end

  self.temporary = opts[:temporary] || false

  super(@message)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



31
32
33
# File 'lib/rmega/errors.rb', line 31

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



31
32
33
# File 'lib/rmega/errors.rb', line 31

def message
  @message
end

#temporaryObject

Returns the value of attribute temporary.



32
33
34
# File 'lib/rmega/errors.rb', line 32

def temporary
  @temporary
end

Instance Method Details

#temporary?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/rmega/errors.rb', line 47

def temporary?
  self.temporary || [-3, -18, -6].include?(@code)
end