From 755d4dba41b4b376f08bba3f5fa17c3782350aea Mon Sep 17 00:00:00 2001 From: Michael Stock Date: Wed, 14 Feb 2018 07:38:58 +0000 Subject: [PATCH] feat: Add 400 response code as a bad request error This allows clients to debug and handle API responses that are caused from malformed requests --- CHANGELOG.md | 2 ++ lib/procore/requestable.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25c5410..366ed75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +* Add 400 responses as Procore::InvalidRequestError + ## 0.7.1 (February 22, 2018) * Fix redis store guard clause diff --git a/lib/procore/requestable.rb b/lib/procore/requestable.rb index e47e3fc..e3369f4 100644 --- a/lib/procore/requestable.rb +++ b/lib/procore/requestable.rb @@ -213,7 +213,7 @@ def with_response_handling "exist.", response: response, ) - when 422 + when 400, 422 raise Procore::InvalidRequestError.new( "Bad Request.", response: response,