Add GrainException to support better error handling from generated grains #2157
+63
−18
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.
Add GrainException which enables throwing a GrainException back on the grain client with a specific message and code from inside a grain message handler. This enables application code to easily provide different error handling behavior based on the code.
For example, if i want to throw an error inside of a grain handler due to bad user input. Right now it just throws a plain exception on the client. With GrainException and especially the new Code property, we can pass something to indicate that the error was due to user input, and not some other unknown error in the code.
This change is fully backwards compatible with existing generated grains and usage.
Description
Purpose
This pull request is a:
Checklist