Sha256: b05ae386a4cb20a38243d293a9cd2aaf388b8e3fc13e6e63e135f65054d1a9d5
Contents?: true
Size: 671 Bytes
Versions: 7
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module PicoApi module Handlers class Errors def self.call(error, response) exception_key = error.class.name.demodulize.to_sym status = PicoApi.configuration.errors_map[exception_key] return system_error(error, response) unless status response.status = status Entities::Errors.call(error).to_h end ServerError = Struct.new(:message) def self.system_error(error, response) response.status = :internal_server_error error = ServerError.new('Something went wrong, we are investigating') Entities::Errors.call(error).to_h end end end end
Version data entries
7 entries across 7 versions & 1 rubygems