Class: Pcli::Output::ServerError

Inherits:
Object
  • Object
show all
Defined in:
lib/pcli/output/server_error.rb

Class Method Summary collapse

Class Method Details

.show(response, output, screen) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pcli/output/server_error.rb', line 6

def self.show(response, output, screen)
  result = ''

  if response.known_error?
    output.puts 'Server:'
    Output::Padded.show([
                          "#{Pl.yellow(response.error.title)} #{Pl.dim("(#{response.error.status})")}",
                          '',
                          response.error.message
                        ], output, screen)
  else
    output.puts "Server #{Pl.yellow("(#{response.code})")}:"
    Output::Padded.show(response.body, output, screen)
  end
  result
end