lib/kb/errors/error.rb in barkibu-kb-0.21.0 vs lib/kb/errors/error.rb in barkibu-kb-0.22.0

- old
+ new

@@ -5,22 +5,23 @@ def initialize(status_code = nil, body = nil, error = nil) super(error) @status_code = status_code @body = body @message = "Received Status: #{status_code}\n#{body}" + @message = error.message if error.present? && body.nil? && status_code.nil? set_backtrace error.backtrace if error end def self.from_faraday(error) - case error.response[:status] + case error.response&.[](:status) when 404 ResourceNotFound when 409 ConflictError when 422 UnprocessableEntityError else self - end.new(error.response[:status], error.response[:body], error) + end.new(error.response&.[](:status), error.response&.[](:body), error) end end end