Sha256: 52aad78b27bc32ac6379284597c872c0b86b076431e22fdcd3810d31bf381a3f

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

module HttpError
  module Response
    extend ActiveSupport::Concern

    included do
      rescue_from HttpError::Error do |error|
        Rails.logger.debug "Rescuing from #{error.class}. Status: #{error.status}. Message: #{error.message}"

        hash = {
          error: error.message,
        }

        render \
          text: error.message,
          json: hash,
          status: error.status
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
http-errors-0.1.0 lib/http_error/response.rb