Sha256: e732b8fc282a4c186492c5b8a212e18ac8560ae27ae7d4330e6d3953e307f335
Contents?: true
Size: 525 Bytes
Versions: 19
Compression:
Stored size: 525 Bytes
Contents
# frozen_string_literal: true class Freddy class ErrorResponse < StandardError DEFAULT_ERROR_MESSAGE = 'Use #response to get the error response' attr_reader :response def initialize(response) @response = response super(format_message(response) || DEFAULT_ERROR_MESSAGE) end private def format_message(response) return unless response.is_a?(Hash) message = [response[:error], response[:message]].compact.join(': ') message.empty? ? nil : message end end end
Version data entries
19 entries across 19 versions & 1 rubygems