class Pandocomatic::PandocomaticError

General pandocomatic error

@!attribute type

@return [Symbol] type of error

@!attribute error

@return [Error] the underlying error, if any

@!attribute data

@return [Object] attached data, if any

Attributes

data[R]
error[R]
type[R]

Public Class Methods

new(type = :unknown, error = nil, data = nil) click to toggle source

Create a new PandocomaticError

@param type [Symbol = :unknown] the type of error, defaults to :unknown @param error [Error = nil] the underlying error, optional @param data [Object = nil] extra information attached to this

PandocomaticError, if any; optional
Calls superclass method
# File lib/pandocomatic/error/pandocomatic_error.rb, line 43
def initialize(type = :unknown, error = nil, data = nil)
  super(type.to_s.gsub('_', ' ').capitalize)
  @type = type
  @error = error
  @data = data
end

Public Instance Methods

data?() click to toggle source

Has this PandocomaticError extra information associated to it?

@return [Boolean]

# File lib/pandocomatic/error/pandocomatic_error.rb, line 60
def data?
  !@data.nil?
end
error?() click to toggle source

Has this PandocomaticError an underlying error?

@return [Boolean]

# File lib/pandocomatic/error/pandocomatic_error.rb, line 53
def error?
  !@error.nil?
end
print() click to toggle source

Print this error.

show() click to toggle source

Show this error

@return [String] a string representation of this PandocomaticError

# File lib/pandocomatic/error/pandocomatic_error.rb, line 72
def show
  ErrorPrinter.new(self).to_s
end