Exception: Pandocomatic::PandocomaticError
- Inherits:
-
StandardError
- Object
- StandardError
- Pandocomatic::PandocomaticError
- Defined in:
- lib/pandocomatic/error/pandocomatic_error.rb
Overview
General pandocomatic error
Direct Known Subclasses
CLIError, ConfigurationError, IOError, PandocError, PandocMetadataError, ProcessorError, TemplateError
Instance Attribute Summary collapse
-
#data ⇒ Object
Attached data, if any.
-
#error ⇒ Error
The underlying error, if any.
-
#type ⇒ Symbol
Type of error.
Instance Method Summary collapse
-
#data? ⇒ Boolean
Has this PandocomaticError extra information associated to it?.
-
#error? ⇒ Boolean
Has this PandocomaticError an underlying error?.
-
#initialize(type = :unknown, error = nil, data = nil) ⇒ PandocomaticError
constructor
Create a new PandocomaticError.
-
#print ⇒ Object
Print this error.
-
#show ⇒ String
Show this error.
Constructor Details
#initialize(type = :unknown, error = nil, data = nil) ⇒ PandocomaticError
Create a new PandocomaticError
43 44 45 46 47 48 |
# 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 |
Instance Attribute Details
#data ⇒ Object
Returns attached data, if any.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 34 class PandocomaticError < StandardError attr_reader :type, :error, :data # 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 def initialize(type = :unknown, error = nil, data = nil) super(type.to_s.gsub('_', ' ').capitalize) @type = type @error = error @data = data end # Has this PandocomaticError an underlying error? # # @return [Boolean] def error? !@error.nil? end # Has this PandocomaticError extra information associated to it? # # @return [Boolean] def data? !@data.nil? end # Print this error. def print ErrorPrinter.new(self).print end # Show this error # # @return [String] a string representation of this PandocomaticError def show ErrorPrinter.new(self).to_s end end |
#error ⇒ Error
Returns the underlying error, if any.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 34 class PandocomaticError < StandardError attr_reader :type, :error, :data # 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 def initialize(type = :unknown, error = nil, data = nil) super(type.to_s.gsub('_', ' ').capitalize) @type = type @error = error @data = data end # Has this PandocomaticError an underlying error? # # @return [Boolean] def error? !@error.nil? end # Has this PandocomaticError extra information associated to it? # # @return [Boolean] def data? !@data.nil? end # Print this error. def print ErrorPrinter.new(self).print end # Show this error # # @return [String] a string representation of this PandocomaticError def show ErrorPrinter.new(self).to_s end end |
#type ⇒ Symbol
Returns type of error.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 34 class PandocomaticError < StandardError attr_reader :type, :error, :data # 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 def initialize(type = :unknown, error = nil, data = nil) super(type.to_s.gsub('_', ' ').capitalize) @type = type @error = error @data = data end # Has this PandocomaticError an underlying error? # # @return [Boolean] def error? !@error.nil? end # Has this PandocomaticError extra information associated to it? # # @return [Boolean] def data? !@data.nil? end # Print this error. def print ErrorPrinter.new(self).print end # Show this error # # @return [String] a string representation of this PandocomaticError def show ErrorPrinter.new(self).to_s end end |
Instance Method Details
#data? ⇒ Boolean
Has this PandocomaticError extra information associated to it?
60 61 62 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 60 def data? !@data.nil? end |
#error? ⇒ Boolean
Has this PandocomaticError an underlying error?
53 54 55 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 53 def error? !@error.nil? end |
#print ⇒ Object
Print this error.
65 66 67 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 65 def print ErrorPrinter.new(self).print end |
#show ⇒ String
Show this error
72 73 74 |
# File 'lib/pandocomatic/error/pandocomatic_error.rb', line 72 def show ErrorPrinter.new(self).to_s end |