Exception: ImportException
- Inherits:
-
StandardError
- Object
- StandardError
- ImportException
- Defined in:
- backend/app/lib/exceptions.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#invalid_object ⇒ Object
Returns the value of attribute invalid_object.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(opts) ⇒ ImportException
constructor
A new instance of ImportException.
-
#to_hash ⇒ Object
-
#to_s ⇒ Object
Constructor Details
#initialize(opts) ⇒ ImportException
Returns a new instance of ImportException.
91 92 93 94 |
# File 'backend/app/lib/exceptions.rb', line 91 def initialize(opts) @invalid_object = opts[:invalid_object] @error = opts[:error] end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error
89 90 91 |
# File 'backend/app/lib/exceptions.rb', line 89 def error @error end |
#invalid_object ⇒ Object
Returns the value of attribute invalid_object
87 88 89 |
# File 'backend/app/lib/exceptions.rb', line 87 def invalid_object @invalid_object end |
#message ⇒ Object
Returns the value of attribute message
88 89 90 |
# File 'backend/app/lib/exceptions.rb', line 88 def end |
Instance Method Details
#to_hash ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'backend/app/lib/exceptions.rb', line 96 def to_hash hsh = {'record_title' => nil, 'record_type' => nil, 'error_class' => self.class.name, 'errors' => []} hsh['record_title'] = @invalid_object[:title] ? @invalid_object[:title] : "unknown or untitled" hsh['record_type'] = @invalid_object.jsonmodel_type ? @invalid_object.jsonmodel_type : "unknown type" if @error.respond_to?(:errors) @error.errors.each {|e| hsh['errors'] << e} else hsh['errors'] = @error.inspect end hsh end |
#to_s ⇒ Object
109 110 111 |
# File 'backend/app/lib/exceptions.rb', line 109 def to_s "#<:ImportException: #{{:invalid_object => @invalid_object, :error => @error}.inspect}>" end |