# class Chef::Formatters::ErrorDescription

## Formatters::ErrorDescription¶ ↑

Class for displaying errors on STDOUT.

### Attributes

sections[R]

### Public Class Methods

new(title) click to toggle source

    # File lib/chef/formatters/error_descriptor.rb, line 28
    def initialize(title)
      @title = title
      @sections = []
    end

### Public Instance Methods

display(out) click to toggle source

    # File lib/chef/formatters/error_descriptor.rb, line 37
    def display(out)
      out.puts "=" * 80
      out.puts @title, :red
      out.puts "=" * 80
      out.puts "\n"
      sections.each do |section|
        section.each do |heading, text|
          display_section(heading, text, out)
        end
      end
    end

for_json() click to toggle source

    # File lib/chef/formatters/error_descriptor.rb, line 49
    def for_json()
      {
        'title' => @title,
        'sections' => @sections
      }
    end

section(heading, text) click to toggle source

    # File lib/chef/formatters/error_descriptor.rb, line 33
    def section(heading, text)
      @sections << {heading => (text or "")}
    end