lib/nanoc/cli/error_handler.rb in nanoc-4.9.6 vs lib/nanoc/cli/error_handler.rb in nanoc-4.9.7

- old
+ new

@@ -244,11 +244,11 @@ else "Install the '#{gem_name}' gem using `gem install #{gem_name}`." end end when RuntimeError - if error.message =~ /^can't modify frozen/ + if /^can't modify frozen/.match?(error.message) 'You attempted to modify immutable data. Some data cannot ' \ 'be modified once compilation has started. Such data includes ' \ 'content and attributes of items and layouts, and filter arguments.' end when Errno::EADDRINUSE @@ -284,16 +284,25 @@ def write_error_message(stream, error, verbose: false) write_section_header(stream, 'Message', verbose: verbose) error = unwrap_error(error) - message = "#{error.class}: #{error.message}" + message = "#{error.class}: #{message_for_error(error)}" unless verbose message = "\e[1m\e[31m" + message + "\e[0m" end stream.puts message resolution = resolution_for(error) stream.puts resolution.to_s if resolution + end + + def message_for_error(error) + case error + when JsonSchema::AggregateError + "\n" + error.errors.map { |e| " * #{e.pointer}: #{e.message}" }.join("\n") + else + error.message + end end def write_item_rep(stream, error, verbose: false) return unless error.is_a?(Nanoc::Int::Errors::CompilationError)