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

Forward port error handling to 2.0.0 #79

Merged

Conversation

weierophinney
Copy link
Member

This patch forward ports the changes from #78 to the dev-2.0.0 branch. For the most part, this results in removal of the feature, as it is made obsolete by the 2.0.0 architecture; the one feature kept is that the MiddlewarePipe::raiseThrowables() method is kept, but deprecated, to allow code changes made for 1.3.0 to opt-in to the ability to raise throwables to continue to work without change when upgrading.

When enabled, any middleware dispatch is no longer wrapped in try/catch
blocks, allowing for exceptions/throwables to bubble out.
Added `$raiseThrowables` property and `raiseThrowables()` method, with
the former defaulting to `false` for backwards compatibility.

Has the following behavior:

- Enables the same flag in the `Dispatch` instance composed.
- If enabled and `$err` is passed to `__invoke()`:
  - Throwable/Exception values are simply thrown.
  - String arguments are used as the message for a new `MiddlewareException`.
  - Scalar values are reported in a new `MiddlewareException`
  - Array value *types* are reported in a new `MiddlewareException`
  - Object *types* are reported in a new `MiddlewareException`
  - Non-throwable/exception types trigger the deprecation notice
- Disabled by default
- `raiseThrowables()` enables it
- When enabled, calls same method on `Next` instance after creating it
…ndling-v2

Forward-ports zendframework#78 to dev-2.0.0.

Conflicts:
	src/Dispatch.php
	src/MiddlewarePipe.php
	src/Next.php
	test/DispatchTest.php
	test/NextTest.php
Removed section on $out, and replaced with detail on $delegate.
Ensure all paths in Dispatch are covered.
…ndling-v2

Forward port changes made for zendframework#78 (in this case, tests that are no
longer applicable).

Conflicts:
	test/DispatchTest.php
…ndling-v2

Forward port changes from zendframework#78.

Conflicts:
	src/Dispatch.php
@weierophinney weierophinney merged commit 69989e3 into zendframework:dev-2.0.0 Nov 8, 2016
weierophinney added a commit that referenced this pull request Nov 8, 2016
weierophinney added a commit that referenced this pull request Nov 8, 2016
@weierophinney weierophinney deleted the feature/error-handling-v2 branch November 8, 2016 23:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
v2
Complete
Development

Successfully merging this pull request may close these issues.

None yet

1 participant