Exception: Coradoc::TransformationError

Inherits:
Error
  • Object
show all
Defined in:
lib/coradoc/errors.rb

Overview

Error raised when transformation fails

Examples:

raise TransformationError.new(
  "Cannot convert element",
  source_type: "Paragraph",
  target_type: "CoreModel::Block"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, source_type: nil, target_type: nil) ⇒ TransformationError

Create a new transformation error

Parameters:

  • message (String)

    The error message

  • source_type (String, Class, nil) (defaults to: nil)

    The source type being transformed

  • target_type (String, Class, nil) (defaults to: nil)

    The target type



260
261
262
263
264
# File 'lib/coradoc/errors.rb', line 260

def initialize(message, source_type: nil, target_type: nil)
  @source_type = source_type
  @target_type = target_type
  super(build_message(message))
end

Instance Attribute Details

#source_typeObject (readonly)

Returns the value of attribute source_type.



253
254
255
# File 'lib/coradoc/errors.rb', line 253

def source_type
  @source_type
end

#target_typeObject (readonly)

Returns the value of attribute target_type.



253
254
255
# File 'lib/coradoc/errors.rb', line 253

def target_type
  @target_type
end