fix: only swallow not-found export deletion errors#312
Open
YunchuWang wants to merge 1 commit into
Open
Conversation
Replace bare catch {} that silently swallowed all errors (including
network failures, auth errors, and timeouts) with a targeted catch
that only swallows gRPC NOT_FOUND errors. All other errors are now
re-thrown so callers can handle or report them.
Add isNotFoundError() helper using duck typing to check gRPC status
code without requiring a direct @grpc/grpc-js dependency.
Add comprehensive unit tests for the delete() error handling path.
Fixes microsoft#212
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes error handling in the export-history package’s ExportHistoryJobClient.delete() so it only treats gRPC NOT_FOUND as the idempotent delete case and rethrows unexpected cleanup failures, improving correctness and operational visibility.
Changes:
- Update
delete()to swallow only gRPCNOT_FOUNDerrors during orchestration cleanup and rethrow all other errors. - Add a local
isNotFoundError()helper (duck-typed) to avoid introducing a direct@grpc/grpc-jsdependency. - Add targeted Jest coverage for delete/cleanup error scenarios (NOT_FOUND vs network/auth/timeout/other).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/durabletask-js-export-history/src/client/export-history-client.ts | Restricts delete cleanup error swallowing to gRPC NOT_FOUND via a local helper and rethrows other failures. |
| packages/durabletask-js-export-history/test/export-history-client-delete.spec.ts | Adds focused unit tests validating delete() behavior for NOT_FOUND vs unexpected gRPC/timeout/plain errors. |
Comment on lines
+42
to
+45
| const TEST_STORAGE_OPTIONS: ExportHistoryStorageOptions = { | ||
| connectionString: "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=key;EndpointSuffix=core.windows.net", | ||
| containerName: "test-container", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #212
Testing
npm test -w @microsoft/durabletask-js-export-history -- --runTestsByPath test/export-history-client-delete.spec.tsnpm run build -w @microsoft/durabletask-js-export-history