lib/lifen/app_authenticated_client.rb in lifen-1.6.2 vs lib/lifen/app_authenticated_client.rb in lifen-1.6.3

- old
+ new

@@ -13,9 +13,15 @@ raise InvalidSecretTokenError, "Error 401, Invalid app bearer, #{response_error(response, params)}" when 403 raise UserAlreadyExistingError, "Error 403, User already existing, #{response_error(response, params)}" when 404 raise Error, "Error 404, Page not found, #{response_error(response, params)}" + when 422 + json = JSON.parse response.body + + diagnostic = json["issue"][0]["diagnostics"] + + raise Error, "Error 422, Unprocessable Entity, Diagnostic: '#{diagnostic}', #{response_error(response, params)}" end end def response_error(response, params) \ No newline at end of file