lib/nanoc/cli/error_handler.rb in nanoc-3.8.0 vs lib/nanoc/cli/error_handler.rb in nanoc-4.0.0a1
- old
+ new
@@ -25,31 +25,25 @@
end
end
# Disables error handling. This is used by the test cases to prevent error
# from being handled by the CLI while tests are running.
- #
- # @api private
def self.disable
@disabled = true
end
# Re-enables error handling after it was disabled. This is used by the test
# cases to prevent error from being handled by the CLI while tests are
# running.
- #
- # @api private
def self.enable
@disabled = false
end
# 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
def handle_while(&_block)
# Set exit handler
%w( INT TERM ).each do |signal|
Signal.trap(signal) do
puts
@@ -68,11 +62,11 @@
end
end
# Run
yield
- rescue Nanoc::Errors::GenericTrivial => e
+ rescue Nanoc::Int::Errors::GenericTrivial => e
$stderr.puts "Error: #{e.message}"
exit(1)
rescue Interrupt
exit(1)
rescue StandardError, ScriptError => e
@@ -111,12 +105,10 @@
#
# @param [Error] error The error that should be described
#
# @param [IO] stream The stream to write the description too
#
- # @api private
- #
# @return [void]
def write_compact_error(error, stream)
# Header
stream.puts
stream.puts 'Captain! We’ve been hit!'
@@ -134,12 +126,10 @@
#
# @param [Error] error The error that should be described
#
# @param [IO] stream The stream to write the description too
#
- # @api private
- #
# @return [void]
def write_verbose_error(error, stream)
# Header
stream.puts "Crashlog created at #{Time.now}"
@@ -162,16 +152,16 @@
# @see Nanoc::CLI.debug?
def debug?
Nanoc::CLI.debug?
end
- # @return [Nanoc::Site] The site that is currently being processed
+ # @return [Nanoc::Int::Site] The site that is currently being processed
def site
@command && @command.site
end
- # @return [Nanoc::Compiler] The compiler for the current site
+ # @return [Nanoc::Int::Compiler] The compiler for the current site
def compiler
site && site.compiler
end
# @return [Array] The current compilation stack
@@ -282,10 +272,10 @@
if stack.empty?
stream.puts ' (empty)'
else
stack.reverse_each do |obj|
- if obj.is_a?(Nanoc::ItemRep)
+ if obj.is_a?(Nanoc::Int::ItemRep)
stream.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
else # layout
stream.puts " - [layout] #{obj.identifier}"
end
end