Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def print_error(error) $stderr.puts # Header $stderr.puts '+--- /!\ ERROR /!\ -------------------------------------------+' $stderr.puts '| An exception occured while compiling the site. If you think |' $stderr.puts '| this is a bug in nanoc, please do report it at |' $stderr.puts '| <http://projects.stoneship.org/trac/nanoc/newticket> -- |' $stderr.puts '| thanks in advance! |' $stderr.puts '+-------------------------------------------------------------+' # Exception $stderr.puts $stderr.puts '=== MESSAGE:' $stderr.puts $stderr.puts "#{error.class}: #{error.message}" # Compilation stack $stderr.puts $stderr.puts '=== COMPILATION STACK:' $stderr.puts if ((@base.site && @base.site.compiler.stack) || []).empty? $stderr.puts " (empty)" else @base.site.compiler.stack.reverse.each do |obj| if obj.is_a?(Nanoc3::ItemRep) $stderr.puts " - [item] #{obj.item.identifier} (rep #{obj.name})" else # layout $stderr.puts " - [layout] #{obj.identifier}" end end end # Backtrace require 'enumerator' $stderr.puts $stderr.puts '=== BACKTRACE:' $stderr.puts $stderr.puts error.backtrace.to_enum(:each_with_index).map { |item, index| " #{index}. #{item}" }.join("\n") end
This paste will be private.
From the Design Piracy series on my blog: