Exception: Miscellany::HttpErrorHandling::HttpError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/miscellany/controller/http_error_handling.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg = nil, status: nil, message: '', **extra) ⇒ HttpError

Returns a new instance of HttpError.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/miscellany/controller/http_error_handling.rb', line 9

def initialize(arg = nil, status: nil, message: '', **extra)
  if arg.is_a?(Numeric)
    raise ArgumentError, ':status supplied multiple times' if status.present?

    status = arg
  elsif arg.present?
    raise ArgumentError, ':message supplied multiple times' if message.present?

    message = arg
  end
  super(message)
  @status = status
  @extra = extra
end

Instance Attribute Details

#extraObject

Returns the value of attribute extra.



8
9
10
# File 'lib/miscellany/controller/http_error_handling.rb', line 8

def extra
  @extra
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/miscellany/controller/http_error_handling.rb', line 8

def status
  @status
end