This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Deprecate FinalHandler and ErrorMiddlewareInterface #66
Merged
weierophinney
merged 14 commits into
zendframework:develop
from
weierophinney:feature/final-handler-deprecation
Sep 28, 2016
Merged
Deprecate FinalHandler and ErrorMiddlewareInterface #66
weierophinney
merged 14 commits into
zendframework:develop
from
weierophinney:feature/final-handler-deprecation
Sep 28, 2016
Commits on Sep 26, 2016
-
Documented changes to error handling via a migration document
In doing so, discovered that if we make `$out` required in v2, there's no need to introduce the `setFinalHandler()` argument, as it can be passed directly, or handled via `Zend\Diactoros\Server::listen()`.
Configuration menu - View commit details
-
Copy full SHA for 90d6281 - Browse repository at this point
Copy the full SHA 90d6281View commit details -
Created NotFoundHandler and ErrorHandler middleware
First step in the journey to remove the FinalHandler. - Bump minimum supported PHP version to 5.6 (allows calling callables without `call_user_func()`, and using `::class` notation). - `NotFoundHandler` returns a basic 404 response, always. - `ErrorHandler`: - creates a PHP error handler that will throw any errors not in the current error_handler mask as ErrorExceptions. - Does a try/catch around `$next()` - Raises a new exception, `MissingResponseException`, if `$next` did not return a response. - Casts all Throwable/Exception items to error responses: - If a boolean true flag is passed to the constructor, it will use the stack trace in the response. - Triggers listeners on the instance with the exception/throwable, request, and response, for reporting purposes. In order to return a response, each middleware type accepts a prototype `ResponseInterface` instance to the constructor; this is then used to generate the returned response in 404/error conditions.
Configuration menu - View commit details
-
Copy full SHA for 9fdb3fa - Browse repository at this point
Copy the full SHA 9fdb3faView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c3ded4 - Browse repository at this point
Copy the full SHA 0c3ded4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 024cbc5 - Browse repository at this point
Copy the full SHA 024cbc5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3363133 - Browse repository at this point
Copy the full SHA 3363133View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b86130 - Browse repository at this point
Copy the full SHA 5b86130View commit details -
Raise deprecation notice by MiddlewarePipe if $out is omitted
We need to notify users that `$out` cannot be omitted starting with version 2.0.0.
Configuration menu - View commit details
-
Copy full SHA for 2aa080d - Browse repository at this point
Copy the full SHA 2aa080dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d8804f - Browse repository at this point
Copy the full SHA 4d8804fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 371e546 - Browse repository at this point
Copy the full SHA 371e546View commit details
Commits on Sep 27, 2016
-
Provide extension points in the
ErrorHandler
implementation- Created a protected method, `createErrorResponse()`, for creating and returning the error response to use. - Made `$isDevelopmentMode` protected, to allow extending classes to query its value.
Configuration menu - View commit details
-
Copy full SHA for 8653c45 - Browse repository at this point
Copy the full SHA 8653c45View commit details -
Compose an error generator, instead of require extension
Per @vaclavvanik, this patch: - Moves the error generation aspects to a new class, `ErrorResponseGenerator`. - Updates the `ErrorHandler`: - to allow passing an optional, callable response generator via the constructor, instead of the `$isDevelopmentMode` flag. - to specify `ErrorResponseGenerator` in production mode if no generator is provided during instantiation. - to trigger the response generator from `handleThrowable()` in order to get an error response, passing the exception, request, and response prototype. - Marks the class final. This allows flexibility in generating error responses without requiring extension, by composing the generator in the handler itself.
Configuration menu - View commit details
-
Copy full SHA for ac371ae - Browse repository at this point
Copy the full SHA ac371aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8499b23 - Browse repository at this point
Copy the full SHA 8499b23View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8f00604 - Browse repository at this point
Copy the full SHA 8f00604View commit details -
Configuration menu - View commit details
-
Copy full SHA for d413d5d - Browse repository at this point
Copy the full SHA d413d5dView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.