Exception: FilePipeline::Errors::FailedModificationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/file_pipeline/errors/failed_modification_error.rb

Overview

Error class for exceptions that are raised when a a FileOperation in a Pipeline returns failure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, info: nil, file: nil) ⇒ FailedModificationError

Returns a new instance.

Arguments
  • msg - error message for the exception. If none provided, the instance will be initialized with the #default_message.

Options
  • info - a FileOperations::Results object or an object.

  • file - path to the file thas was being processed.



22
23
24
25
26
27
# File 'lib/file_pipeline/errors/failed_modification_error.rb', line 22

def initialize(msg = nil, info: nil, file: nil)
  @file = file
  @info = info
  msg ||= default_message
  super msg
end

Instance Attribute Details

#infoObject (readonly)

The file opration that caused the error.



9
10
11
# File 'lib/file_pipeline/errors/failed_modification_error.rb', line 9

def info
  @info
end

Instance Method Details

#original_backtraceObject

Returns the backtrace of the error that caused the exception.



30
31
32
# File 'lib/file_pipeline/errors/failed_modification_error.rb', line 30

def original_backtrace
  original_error&.backtrace&.join("\n")
end

#original_errorObject

Returns the error that caused the exception.



35
36
37
# File 'lib/file_pipeline/errors/failed_modification_error.rb', line 35

def original_error
  @info.log.find { |item| item.is_a? Exception }
end