Sha256: 0304c5e9e61f822f2e280bba65561b5ba145f4ade78fa5735e987e0152aa2e47
Contents?: true
Size: 450 Bytes
Versions: 3
Compression:
Stored size: 450 Bytes
Contents
# frozen_string_literal: true module Dato class ApiError < StandardError attr_reader :response, :body def initialize(response) body = JSON.parse(response[:body]) if response[:body] message = [ "DatoCMS API Error", "Status: #{response[:status]}", "Response:", JSON.pretty_generate(body), ].join("\n") super(message) @response = response @body = body end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dato-0.8.3 | lib/dato/api_error.rb |
dato-0.8.2 | lib/dato/api_error.rb |
dato-0.8.1 | lib/dato/api_error.rb |