lib/berkshelf/errors.rb in berkshelf-3.0.1 vs lib/berkshelf/errors.rb in berkshelf-3.1.0

- old
+ new

@@ -67,15 +67,17 @@ status_code(106) attr_reader :demands # @param [Array<Dependency>] demands - def initialize(demands) + def initialize(demands, original_exception) @demands = demands + @original_exception = original_exception end def to_s + @original_exception.to_s + "Unable to find a solution for demands: #{demands.join(', ')}" end end class CookbookSyntaxError < BerkshelfError; status_code(107); end @@ -448,8 +450,33 @@ "at least one source in order to download cookbooks. To add the " \ "default Berkshelf API server, add the following code to the top of " \ "your Berksfile:" \ "\n\n" \ " source 'https://api.berkshelf.com'" + end + end + + class GraphvizNotInstalled < BerkshelfError + status_code(147) + + def to_s + "Graphviz is not installed! In order to generate a dependency graph, " \ + "you must install Graphviz. Please visit the Graphviz homepage at " \ + "http://www.graphviz.org/ or consult your package manager for more " \ + "information on how to install Graphviz." + end + end + + class GraphvizCommandFailed < BerkshelfError + status_code(148) + + def initialize(command, output) + @command = command + @output = output + end + + def to_s + "The Graphviz command `#{@command}` failed to execute properly. Here " \ + "is the standard error from the command:\n\n#{@output}" end end end