php-http / httplug

HTTPlug, the HTTP client abstraction for PHP
http://httplug.io
MIT License
2.57k stars 39 forks source link

Remove BatchResult implementation, remove custom SPL exceptions #60

Closed sagikazarmark closed 9 years ago

sagikazarmark commented 9 years ago

I removed the BatchResult implementation from the main repo, it is going to be in the utility repo.

Some other major changes in this PR:

I removed custom SPL exception extensions.

Reasoning:

The reasons why we have an Exception interface are:

However doing so only make sense when one of the domain exceptions is thrown. For example BatchException. It can be caught by catching the Exception interface. However, exceptions thrown by that BatchException (RuntimeException, UnexpectedValueException) should be handled locally, because they are usually because some sort of logic issue (like getResult called before it is set).

So in this PR I removed all custom SPL exceptions and started to use the core ones. If we ever need more exceptions, like we have now, we can always create new domain exceptions.

What do you think guys?

sagikazarmark commented 9 years ago

There is one question though:

Currently the BatchException only accepts instances of our Exception interface. Should it accept any kind of exceptions? Of course exceptions should be converted to ours if possible, and I can't really imagine any cases where it wouldn't. Still, we should consider this question. (But I rather think we should keep this restriction)

hannesvdvreken commented 9 years ago

:+1: