Class Nanoc::CLI::ErrorHandler
In: lib/nanoc/cli/error_handler.rb
Parent: Object

Catches errors and prints nice diagnostic messages, then exits.

@api private

Methods

Constants

GEM_NAMES = { 'adsf' => 'adsf', 'bluecloth' => 'bluecloth', 'builder' => 'builder', 'coderay' => 'coderay', 'cri' => 'cri', 'erubis' => 'erubis', 'escape' => 'escape', 'fog' => 'fog', 'fssm' => 'fssm', 'haml' => 'haml', 'json' => 'json', 'kramdown' => 'kramdown', 'less' => 'less', 'markaby' => 'markaby', 'maruku' => 'maruku', 'mime/types' => 'mime-types', 'nokogiri' => 'nokogiri', 'rack' => 'rack', 'rack/cache' => 'rack-cache', 'rainpress' => 'rainpress', 'rdiscount' => 'rdiscount', 'redcarpet' => 'redcarpet', 'redcloth' => 'RedCloth', 'rubypants' => 'rubypants', 'sass' => 'sass', 'systemu' => 'systemu', 'w3c_validators' => 'w3c_validators'   A hash that contains the name of the gem for a given required file. If a `require` fails, the gem name is looked up in this hash.

Public Class methods

Enables error handling in the given block.

@option params [Nanoc::CLI::Command, nil] command The command that is

  currently being executed, or nil if there is none

@return [void]

@option params [Nanoc::CLI::Command, nil] command The command that is

  currently being executed, or nil if there is none

Prints the given error to stderr. Includes message, possible resolution (see {resolution_for}), compilation stack, backtrace, etc.

@param [Error] error The error that should be described

@return [void]

Public Instance methods

Enables error handling in the given block. This method should not be called directly; use {Nanoc::CLI::ErrorHandler.handle_while} instead.

@return [void]

@api private

Prints the given error to stderr. Includes message, possible resolution (see {resolution_for}), compilation stack, backtrace, etc.

@param [Error] error The error that should be described

@return [void]

Protected Instance methods

@return [Nanoc::Compiler] The compiler for the current site

@return [Boolean] true if debug output is enabled, false if not

@see Nanoc::CLI.debug?

Attempts to find a resolution for the given error, or nil if no resolution can be automatically obtained.

@param [Error] error The error to find a resolution for

@return [String] The resolution for the given error

@return [Nanoc::Site] The site that is currently being processed

@return [Array] The current compilation stack

[Validate]