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

Implement ExceptionResult, ExceptionResult<T>, and CatchAllException #789

Closed
jefflill opened this issue Mar 29, 2020 · 1 comment
Closed
Assignees
Labels
common Neon.Common related issues feature New feature or request

Comments

@jefflill
Copy link
Collaborator

jefflill commented Mar 29, 2020

We're going to add these as general purpose exceptions to Neon.Common and then use them immediately for #785.

The basic idea here is to provide a common way for frameworks like Neon.Cadence to be able to marshal a method call across processes such that exceptions thrown by the callee process can be rethrown (when possible) in the caller process.

The idea would be to implement ExceptionResult and ExceptionResult<TResult> classes. The first would be used for operations that return void and the second version would be used for operations that do return a result.

Both of these classes would include string ExceptionType and string ExceptionMessage properties. The idea is that workflows and activities would return one of these types and we'd have try/catch blocks in these methods that would catch exceptions and then set ExceptionType to the fully qualified name of the exception type and ExceptionMessage to the message text and then return the exception result instance if there was an exception or an exception result instance with these properties set to null when there was no exception.

The base ExceptionType class would have a static constructor that reflects all loaded assemblies to locate all known exception types to create a dictionary that maps the fully qualified names of any exceptions found to some code that can rethrow exceptions in the caller process.

It may be possible that the caller process does not have the same exception types that exist and were thrown by the callee. In this case, ExceptionType will throw a CatchAllException including the fully qualified name of the exception thrown by the callee as well as the exception message.

@jefflill jefflill self-assigned this Mar 29, 2020
@jefflill jefflill added active common Neon.Common related issues feature New feature or request labels Mar 29, 2020
@jefflill jefflill removed the active label Mar 30, 2020
@jefflill
Copy link
Collaborator Author

Implemented for v2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Neon.Common related issues feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant