Skip to content
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

Exception code != API Problem status #3

Closed
snapshotpl opened this issue May 17, 2017 · 1 comment
Closed

Exception code != API Problem status #3

snapshotpl opened this issue May 17, 2017 · 1 comment

Comments

@snapshotpl
Copy link

I worried about this new package introducing same seriously issue like in zfcampus/zf-api-problem#27

When ProblemDetailsMiddleware catch exception (for example MySQL connection problem) then we cannot put code of this exception and what is worse put message from exception to detail.

I have many services with apigility and I need to care about leaking implementation details by my self, but we can handle it out-of-box.

@weierophinney
Copy link
Owner

Just to clarify, the problem you have is with using the exception code for the HTTP status, correct?

Right now, I check to see if the status is within an acceptable range for HTTP statuses (100-599); this should likely be shrunk to only allow statuses between 400 and 599, which I can do immediately. If the exception falls outside that range, the component will use status 500 always.

My question: how many exceptions have you seen or used that use exception codes in the 400-599 integer range that were not deliberately thrown with the intention of allowing the code to be used as the HTTP status? Essentially, is this a problem? I really want to know; I rarely see exception codes other than zero, except coming from extensions, and those from extensions are usually 5 or more digits, making them fall well outside normal HTTP status ranges. If you can provide examples otherwise, I'd love to see them.

For now, I'll make the change I suggested above.

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

No branches or pull requests

2 participants