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

Set "WasSuccess" to "False" without throwing an exception #61

Closed
senj opened this issue May 2, 2017 · 2 comments
Closed

Set "WasSuccess" to "False" without throwing an exception #61

senj opened this issue May 2, 2017 · 2 comments
Labels

Comments

@senj
Copy link

senj commented May 2, 2017

Hey guys,

is it possible to set the WasSuccess value to false within the command without throwing an exception?
We log every thrown exception but in some commands its normal that we don't get a result so I would return null / empty result and it would be nice to react to this with the same logic as if there would have been an error.
Throwing exceptions is a bit too costly (stacktrace etc.)

@robhruska
Copy link
Member

There's not currently a way to do this. For a workaround, you might handle the exception in the command's execute method and return a result that has your own status as a property.

@robhruska
Copy link
Member

I'd be interested in understanding the need here more. If you had the ability to do this, what would the API look like for it? Would it happen within the execute method, or somewhere outside of it? What's the specific case for the empty result that doesn't quite fit within the current way of doing things? Maybe throw some pseudocode here for discussion.

@senj senj closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants