Skip to content

Base exception #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2016
Merged

Base exception #67

merged 1 commit into from
Jul 4, 2016

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jul 2, 2016

Writing #66 made me think of introducing a base exception that all our exception extends from. This will make it easier to catch a discovery exception in case something goes wrong.

This will be extra relevant if #66 gets merged because it introduces another exception.

@sagikazarmark
Copy link
Member

I would be happier with a marker interface.

@Nyholm
Copy link
Member Author

Nyholm commented Jul 2, 2016

But you cant catch an interface, right? Or can you? If so, an interface is way better.

try {
$client = HttpClientDiscovery::find()
} catch(DiscoveryExceptionInterface $e) {
 // log
}

@sagikazarmark
Copy link
Member

Of course you can. As long as the implementation extends \Exception. Leave the interface suffix. Just Http\Discovery\Exception. See the httplug repo.

@Nyholm
Copy link
Member Author

Nyholm commented Jul 2, 2016

Cool, thank you. I've updated the PR.

namespace Http\Discovery;

/**
* An interface implemented by all our exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exceptionS

@sagikazarmark
Copy link
Member

sagikazarmark commented Jul 3, 2016

Can you please add a changelog entry too? (You might need to rebase your branch though, I added change logs in the master as well)

@Nyholm
Copy link
Member Author

Nyholm commented Jul 3, 2016

PR updated.

namespace Http\Discovery;

/**
* An interface implemented by all our exceptions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/by all our/by all discovery related/

@Nyholm Nyholm force-pushed the exception branch 2 times, most recently from dfc0056 to 400e1a5 Compare July 4, 2016 18:56
@Nyholm
Copy link
Member Author

Nyholm commented Jul 4, 2016

Rebased and squashed.

@sagikazarmark sagikazarmark merged commit 96419ad into php-http:master Jul 4, 2016
@Nyholm
Copy link
Member Author

Nyholm commented Jul 4, 2016

Thank you for merging.

@Nyholm Nyholm deleted the exception branch July 4, 2016 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants