Exception: UffizziCore::ComposeFileError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, error_key = nil, extra_errors = {}) ⇒ ComposeFileError

Returns a new instance of ComposeFileError.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/errors/uffizzi_core/compose_file_error.rb', line 6

def initialize(message, error_key = nil, extra_errors = {})
  if [NilClass, String].exclude?(error_key.class)
    raise StandardError.new("#{self.class} arg 'error_key' should be a #{String} or #{NilClass}")
  end

  unless extra_errors.is_a?(Hash)
    raise StandardError.new("#{self.class} arg 'extra_errors' should be a #{Hash}")
  end

  @errors = error_key.nil? ? {} : { error_key => message.to_s }.merge(extra_errors)

  super(message)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



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

def errors
  @errors
end