Skip to content

Conversation

@quickthyme
Copy link
Owner

The way it works now, (or when using this in disabled mode once this gets merged), this is handled on a case-by-case basis within a given operation by unwrapping Results using the built-in get() function, which either returns the value or throws on failure.

This PR makes it so that you don't have to do this case-by-case, and instead can have the built-in error propagation just handle it automatically without the boilerplate check.

Here, the Anchor checks if it's value is a Result<_, Error> and then looks for a .failure. If one is found, it will automatically reroute it down the error path so that any errorHandlers and/or onError triggers can catch them as expected.

This config will be enabled by default, but can be disabled using the QLCommon.Config.Anchor.autoThrowResultFailures global setting.

Signed-off-by: James Hall <james.hall@vmlyr.com>
@quickthyme quickthyme merged commit 45b6a15 into master Jul 12, 2019
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

Successfully merging this pull request may close these issues.

3 participants