Skip to content

Invocation error model overhaul#507

Merged
slinkydeveloper merged 3 commits intorestatedev:mainfrom
slinkydeveloper:issues/421
Jun 21, 2023
Merged

Invocation error model overhaul#507
slinkydeveloper merged 3 commits intorestatedev:mainfrom
slinkydeveloper:issues/421

Conversation

@slinkydeveloper
Copy link
Copy Markdown
Contributor

This PR fixes at the same time #421 and #494. I tried to develop them independently, but at some point I had to intersect those efforts. Depends on restatedev/service-protocol#27.

Changes:

  • Introduce InvocationErrorCode and InvocationError, to model all the possible invocation errors, and their variants.
  • InvocationErrorCode is split between UserErrorCode, which are the error codes user visible, and RestateErrorCode, which are specific error codes generated by the Restate infrastructure. The former matches the set of error codes from gRPC, and are used for the "exceptional result values" of invocation results. Given the SDK supports it (e.g. supporting the StatusRuntimeException in the java SDK), the user can create failures himself with a code from this set. The latter are used mostly for reporting specific errors generated by Restate, and guide the user through the resolution of given problems.
    • In particular, it is relevant the conversion InvocationErrorCode -> UserErrorCode, as some subsystems of Restate, e.g. the gRPC ingress or the InvokeEntryMessage.failure, can understand only the restricted error space given by gRPC. For example, when killing an invocation, the ingress will see this as error code Aborted, while the tracing will notify the error code Killed to the user to be more specific about the actual problem.
  • Implement the new ErrorMessage, notably parsing, conversion to InvocationError and propagation when retries are not set (more on this topic to follow in next PRs)
  • Replace all the various i32, ErrorCode and tonic::Code with either InvocationErrorCode or UserErrorCode, depending on the context. With this change, it is now more clear the context of possible failure cases.

Copy link
Copy Markdown
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this PR. The changes look good to me. I really like that we now have our own error codes that can be mapped at the periphery to gRPC error codes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like that you've introduced our own error code!

…8..3f19659

3f19659 Modify the ErrorMessage to carry more info about the journal_mismatch and protocol_violation cases (#27)
8966ee4 Introduce `ErrorMessage` (#26)
4a993ae Protocol spec (#25)

git-subtree-dir: src/service_protocol/service-protocol
git-subtree-split: 3f19659f7d7feff86775923daf74ba06d1a362ec
* Introduce InvocationErrorCode and InvocationError to model errors arisen during the execution of an invocation. Fix #421
* Implement parsing and conversion of ErrorMessage, plus propagate change i32 -> u32 of the error type. Fix #494
@slinkydeveloper slinkydeveloper merged commit 3c4c6bf into restatedev:main Jun 21, 2023
@slinkydeveloper slinkydeveloper deleted the issues/421 branch June 21, 2023 13:58
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.

2 participants