Skip to content

Add Exception configuration documentation #186

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

Closed

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Mar 20, 2017

Follows #173.

@dunglas
Copy link
Member Author

dunglas commented Mar 20, 2017

Ready for review, ping @GregoireHebert


The framework also allows to configure the HTTP status code sent to the clients when custom exceptions are thrown.

In the following example, we will throw explain to throw a domain exception from the business layer of the application and
Copy link
Contributor

Choose a reason for hiding this comment

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

[...] we will throw explain to throw a domain exception [...]

The framework also allows to configure the HTTP status code sent to the clients when custom exceptions are thrown.

In the following example, we will throw explain to throw a domain exception from the business layer of the application and
configure API Platform to convert it to a `404 Not Found` error. Let's create a this domain exception and the service throwing
Copy link
Contributor

Choose a reason for hiding this comment

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

[...] Let's create a this domain exception [...]

}

if (!$product->isPubliclyAvailable()) {
// Using internal codes for a better understanding of what's going on
Copy link
Contributor

Choose a reason for hiding this comment

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

Finally there isn't internal code used here... Maybe remove the comment ?

@Simperfit
Copy link
Contributor

This needs a rebase, @GregoireHebert could you please do it ?

@GregoireHebert
Copy link
Contributor

Oh sorry no, I can't, this is dunglas branch based on mine... I did it in another PR.
AhAh 😅 !

@dunglas dunglas closed this Feb 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants