Skip to content

fix: preserve RestateError.code in RetryableError.from() and PauseError.from() - #810

Merged
slinkydeveloper merged 1 commit into
restatedev:mainfrom
shafiktanbir:patch-1
Oct 28, 2026
Merged

slinkydeveloper merged 1 commit into
restatedev:mainfrom
shafiktanbir:patch-1

Conversation

@shafiktanbir

@shafiktanbir shafiktanbir commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #809

In packages/libs/restate-sdk/src/types/errors.ts, RestateError stores its numeric status code on error.code, and ensureError(cause) wraps { code, message } objects into new RestateError(e.message, { errorCode: e.code }).

Both RetryableError.from(cause, options) and PauseError.from(cause) read error["errorCode"], which is undefined on RestateError instances and resets .code to 500. This checks error instanceof RestateError ? error.code : (error["errorCode" as keyof typeof error] as number | undefined) so RestateError status codes are preserved.

ss
Image

@slinkydeveloper
slinkydeveloper merged commit 7e415d9 into restatedev:main Oct 28, 2026
11 checks passed
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.

RetryableError.from() and PauseError.from() drop RestateError.code and reset error code to 500

2 participants