Exception: Pendragon::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pendragon/error.rb

Overview

A base class for error responses ResponseError#status and ResponseError#body must be implemented by subclass

Direct Known Subclasses

BadRequest, MethodNotAllowed, NotFound

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ResponseError

Returns a new instance of ResponseError.



8
9
10
# File 'lib/pendragon/error.rb', line 8

def initialize(*args)
  @args = args
end

Instance Method Details

#bodyObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/pendragon/error.rb', line 20

def body
  raise NotImplementedError, "`body` must be implemented by subclass"
end

#callObject



12
13
14
# File 'lib/pendragon/error.rb', line 12

def call
  [status, headers, Array(body)]
end

#headersObject



24
25
26
# File 'lib/pendragon/error.rb', line 24

def headers
  @headers ||= { "Content-Type" => "text/plain" }
end

#statusObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/pendragon/error.rb', line 16

def status
  raise NotImplementedError, "`status` must be implemented by subclass"
end