Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Getting Apigility to return a 500 response on a PHP Fatal Error #157

Open
danbroooks opened this issue Mar 1, 2016 · 5 comments
Open

Getting Apigility to return a 500 response on a PHP Fatal Error #157

danbroooks opened this issue Mar 1, 2016 · 5 comments

Comments

@danbroooks
Copy link

When PHP throws a fatal error, it spits out the HTML representation of error and it does so with a response code of 200.

Should these not be getting caught by Apigility and handled as 500 errors? Is there an extra step I need to take to achieve this, guidance on best practice?

@spengilley
Copy link

Well I certainly agree that this shouldn't return a 200...Any input from regular contributors?

@TomHAnderson
Copy link

Error handling is the responsibility of each application and does not fall into the scope of Apigility.
Write your own error handler which returns a 500 ApiProblem (like) response.

@jasonherndon
Copy link

Error handling is the responsibility of each application and does not fall into the scope of Apigility.

@TomHAnderson Normally I'd agree, but I seem to keep running into places where Apigility is interfering with the normal request lifecycle or places where it's returning 200 or 500 when an error is happening before it can ever hit my try/catch block.

Do you know of any resources that document the Apigility request lifecycle? I think this would be a helpful tool for debugging and something that the community could help contribute to the docs.

@TomHAnderson
Copy link

If you would study the code and create the docs you're asking about I'm sure they could be included.

@michalbundyra
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools; a new issue has been opened at laminas-api-tools/api-tools#33.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants