class Locd::RequestError

Base class for {HandledError} that happen during request processing which should result in useful error responses to the user.

Constants

STATUS_CODE
STATUS_MESSAGE

Attributes

text[R]

TODO document `text` attribute.

@return [attr_type]

Public Class Methods

new(text = self.class::STATUS_MESSAGE) click to toggle source
Calls superclass method
# File lib/locd/errors.rb, line 37
def initialize text = self.class::STATUS_MESSAGE
  @text = text
  super "#{ self.class.status }\n\n#{ text }"
end
status() click to toggle source
# File lib/locd/errors.rb, line 25
def self.status
  "#{ self::STATUS_CODE } #{ self::STATUS_MESSAGE }"
end

Public Instance Methods

to_http_response() click to toggle source
# File lib/locd/errors.rb, line 42
def to_http_response
  Locd.http_response_for self.class.status, text
end
to_proxy_machine_cmd() click to toggle source
# File lib/locd/errors.rb, line 46
def to_proxy_machine_cmd
  { close: to_http_response }
end