Exception: Uniword::ConversionError

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

Overview

Raised when a conversion between formats fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_format, to_format, reason) ⇒ ConversionError

Returns a new instance of ConversionError.

Parameters:

  • from_format (Symbol)

    The source format

  • to_format (Symbol)

    The target format

  • reason (String)

    The reason for failure



131
132
133
134
135
136
# File 'lib/uniword/errors.rb', line 131

def initialize(from_format, to_format, reason)
  super("Cannot convert from #{from_format} to #{to_format}: #{reason}")
  @from_format = from_format
  @to_format = to_format
  @reason = reason
end

Instance Attribute Details

#from_formatSymbol (readonly)

Returns The source format.

Returns:

  • (Symbol)

    The source format



139
140
141
# File 'lib/uniword/errors.rb', line 139

def from_format
  @from_format
end

#reasonString (readonly)

Returns The reason.

Returns:

  • (String)

    The reason



145
146
147
# File 'lib/uniword/errors.rb', line 145

def reason
  @reason
end

#to_formatSymbol (readonly)

Returns The target format.

Returns:

  • (Symbol)

    The target format



142
143
144
# File 'lib/uniword/errors.rb', line 142

def to_format
  @to_format
end