Exception: Platanus::StatusError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/platanus/http_helpers.rb

Overview

Allows to use an exception driven scheme to notify the request that a especial status should be send back to the client. Usefull when used with api_base or rescue_from.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_msg = nil) ⇒ StatusError

Returns a new instance of StatusError.



26
27
28
# File 'lib/platanus/http_helpers.rb', line 26

def initialize(_msg=nil)
  @msg = _msg
end

Class Method Details

.messageObject



24
# File 'lib/platanus/http_helpers.rb', line 24

def self.message; "status_#{@status.to_s}"; end

.setup(_status) ⇒ Object



19
20
21
# File 'lib/platanus/http_helpers.rb', line 19

def self.setup(_status)
  @status = _status
end

.statusObject



23
# File 'lib/platanus/http_helpers.rb', line 23

def self.status; @status; end

Instance Method Details

#messageObject



31
# File 'lib/platanus/http_helpers.rb', line 31

def message; if @msg.nil? then self.class.message else @msg end; end

#statusObject



30
# File 'lib/platanus/http_helpers.rb', line 30

def status; self.class.status; end