Exception: Morpho::Exceptions::StandardError

Inherits:
StandardError
  • Object
show all
Defined in:
app/api/morpho/exceptions/standard_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ StandardError

Returns a new instance of StandardError.



8
9
10
11
12
13
14
15
16
# File 'app/api/morpho/exceptions/standard_error.rb', line 8

def initialize(*args)
  options = args.extract_options!

  @status = options[:status] || 422
  @message = options[:message] || I18n.t("morpho.api.messages.general.#{@status}")
  @errors = options[:errors] || {}

  super(@message)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'app/api/morpho/exceptions/standard_error.rb', line 6

def errors
  @errors
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'app/api/morpho/exceptions/standard_error.rb', line 5

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'app/api/morpho/exceptions/standard_error.rb', line 4

def status
  @status
end