kbsali / php-redmine-api

A simple PHP Redmine API client, Object Oriented

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add new exception on unexpected response

Art4 opened this issue · comments

In #329 we introduced the new list() methods. Theses methods always return an array.

It is possible that the Redmine server responses with an unexpected body, e.g. because a parameter was set incorrectly (see #335). In this case the parsing of the body will fail, causing a SerializerException. This results in a bad DX as the developer has no clue why the parsing of the body fails.

We should catch this exceptions in the list() methods and re-throw them with a more meaningful exception. I propose a new UnexpectedResponseException or a more general ResponseException.