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

Provide initial implementation #1

Merged
merged 8 commits into from
Jun 27, 2019
Merged

Conversation

lcobucci
Copy link
Owner

No description provided.

lcobucci added 8 commits June 27, 2019 17:11
Depending on the application mode, we may need extra debugging
information in the response body - which can definitely help us to solve
the issue more easily.

This provides the extension point and two default implementations:

 - `NoDebugInfo`: aimed for production mode, doesn't add any debug
   information
 - `NoTrace`: aimed for development mode, extracts all exception
   data but the trace - also for previous exceptions.
One of the main differentiators of this package is the usage of marker
interfaces to perform the translation from error/exception to HTTP
responses.

This provides the extension point for that operation and a default
strategy using a translation map (class/interface -> HTTP status code).
This proposes the split between logging and converting errors into
response.

The idea is to always add a debug message with the error that happened,
which is handy for both production and development.
In combination with an access log middleware we can log errors or
warnings, depending on the final response status code.

For production, we assume that a fingers crossed handler is used so that
only errors are sent to log - with enough information.

More info:

 - https://github.com/middlewares/access-log/blob/master/src/AccessLog.php
 - https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/FingersCrossedHandler.php
@lcobucci lcobucci added the New Feature Request or addition of new feature label Jun 27, 2019
@lcobucci lcobucci added this to the 1.0.0 milestone Jun 27, 2019
@lcobucci lcobucci self-assigned this Jun 27, 2019
@lcobucci lcobucci merged commit 9353cdc into master Jun 27, 2019
@lcobucci lcobucci deleted the provide-initial-implementation branch June 27, 2019 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature Request or addition of new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant