dapr / dapr/js-sdk

Inconsistent error handling between communication protocol for state management

Open
#481 3 comments 2 reactions 0 assignees View on GitHub
breaking-change enhancement pinned
Dominant language
JavaScript
Stars
217
Forks
104
PR merge metrics
No merged PRs in 30d

Description

## Expected Behavior

Whether you use HTTP or gRPC shouldn't matter for coding.

## Actual Behavior
The [save() method](https://github.com/dapr/js-sdk/blob/main/src/implementation/Client/GRPCClient/state.ts#L80) in the gRPC implementation throws an exception on failure, which is great
However, the same [save() method](https://github.com/dapr/js-sdk/blob/main/src/implementation/Client/HTTPClient/state.ts#L52) in the HTTP implementation returns an object containing an error without actually throwing an exception.

## Steps to Reproduce the Problem
You can see this in the code itself

Re-trowing the error in the HTTP implementation should fix this, and perhaps using the [cause](https://nodejs.org/api/errors.html#errorcause) attribute on top of that to chain errors would also help with debugging.

I can help with this if needed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.