Sha256: 1351d8a7b0cf650c24b4f44d08860b56eb58f733d030dd507b7cca7a4518f6db

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

module Pcli
  module Output
    class ServerError
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcli-0.1.1 lib/pcli/output/server_error.rb
pcli-0.1.0 lib/pcli/output/server_error.rb