Exception: ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
app/errors/api_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta: {}) ⇒ ApiError

Returns a new instance of ApiError.



4
5
6
# File 'app/errors/api_error.rb', line 4

def initialize(meta: {})
  @meta = meta
end

Instance Attribute Details

#metaObject (readonly)

Returns the value of attribute meta.



2
3
4
# File 'app/errors/api_error.rb', line 2

def meta
  @meta
end

Instance Method Details

#serializeObject



8
9
10
11
12
13
14
15
# File 'app/errors/api_error.rb', line 8

def serialize
  errors = instance_variables.each_with_object({}) do |exceptions, var|
    exceptions[var.to_s.gsub(/@/, '')] = instance_variable_get(var)
    exceptions
  end

  { errors: errors }
end