Exception: ImportException
- Inherits:
-
StandardError
- Object
- StandardError
- ImportException
- Defined in:
- backend/app/lib/exceptions.rb
Instance Attribute Summary (collapse)
-
- (Object) error
Returns the value of attribute error.
-
- (Object) invalid_object
Returns the value of attribute invalid_object.
-
- (Object) message
Returns the value of attribute message.
Instance Method Summary (collapse)
-
- (ImportException) initialize(opts)
constructor
A new instance of ImportException.
-
- (Object) to_hash
-
- (Object) to_s
Constructor Details
- (ImportException) initialize(opts)
Returns a new instance of ImportException
80 81 82 83 |
# File 'backend/app/lib/exceptions.rb', line 80 def initialize(opts) @invalid_object = opts[:invalid_object] @error = opts[:error] end |
Instance Attribute Details
- (Object) error
Returns the value of attribute error
78 79 80 |
# File 'backend/app/lib/exceptions.rb', line 78 def error @error end |
- (Object) invalid_object
Returns the value of attribute invalid_object
76 77 78 |
# File 'backend/app/lib/exceptions.rb', line 76 def invalid_object @invalid_object end |
- (Object) message
Returns the value of attribute message
77 78 79 |
# File 'backend/app/lib/exceptions.rb', line 77 def end |
Instance Method Details
- (Object) to_hash
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'backend/app/lib/exceptions.rb', line 85 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 |
- (Object) to_s
98 99 100 |
# File 'backend/app/lib/exceptions.rb', line 98 def to_s "#<:ImportException: #{{:invalid_object => @invalid_object, :error => @error}.inspect}>" end |