Exception: ApiValve::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/api_valve/error.rb

Constant Summary collapse

Client =
Class.new(self)
Server =
Class.new(self)
NotRouted =
Class.new(self) do
  self.http_status = 404
end

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Error

Returns a new instance of Error.



22
23
24
25
# File 'lib/api_valve/error.rb', line 22

def initialize(*args)
  @options = args.extract_options!
  super(args.first || default_message)
end

Instance Method Details

#codeObject



27
28
29
# File 'lib/api_valve/error.rb', line 27

def code
  @options[:code] || self.class.code
end

#titleObject



31
32
33
# File 'lib/api_valve/error.rb', line 31

def title
  @options[:title] || self.class.title
end