Sha256: 7b212eccd535a09c394ec27c782f95fba80228bafa866cb825fb4cda922e8eb9
Contents?: true
Size: 494 Bytes
Versions: 37
Compression:
Stored size: 494 Bytes
Contents
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
37 entries across 37 versions & 2 rubygems