Skip to content

Exceptions #87

Closed
Closed
@sagikazarmark

Description

@sagikazarmark

Exceptions in promises

If I understand it well, in case of async requests the async request method should NEVER EVER throw an exception, but return and reject a promise.

This is currently not the case:
https://github.com/php-http/guzzle6-adapter/blob/master/src/Guzzle6Promise.php#L66

SPL or not

Although we agreed that SPL exceptions can be used to determine exceptions not closely related to the domain, we might want to reconsider this.

The point of the common Exception interface is that every exception can be caught. On the other side: creating a custom version of every SPL exception which implements our interface seems to be dumb.

The ideal solution would be creating domain exceptions for each case we would use an SPL one.

For example in this case:
https://github.com/php-http/guzzle6-adapter/blob/master/src/Guzzle6Promise.php#L66

This decision should take effect in the Promise interface as well: currently it is restricted to our Exception interface.

Update: Using anonymus classes would be a good solution, but that is only available in PHP 7. Maybe we could place custom extensions in one of our utils repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions