ardohr-ltd / starling-payments-objects

Starling Bank Payments Service data objects
4 stars 1 forks source link

Creating a collection from an error Response fails #8

Closed judgej closed 6 years ago

judgej commented 6 years ago

Any non-collection response object can be created from an error response (e.g. a 400 or 404). That stores the error and the isError() method indicates that this has happened.

A collection response created in the same way (e.g. a collection as past payments, but for an account that is disabled, or when a network issue is happening) results in an exception. It shouldn't.

judgej commented 6 years ago

There is a little duplication in the HydratableTrait::fromResponse and the AbstractCollection::fromResponse that can be merged somewhere to neaten things up. But otherwise, this is fixed now.