java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

State management with Java SDK - clarify error message when etag is incorrect

Open fvitolo opened this issue 2 years ago • 0 comments

Describe the proposal

Currently, when you update the value of a key in the state and do not pass the etag correctly, you receive this generic error message:

**io.dapr.exceptions.DaprException: ERR_STATE_SAVE: failed saving state in state store general-purpose-service-store: no item was updated**
	at io.dapr.client.DaprHttp$ResponseFutureCallback.onResponse(DaprHttp.java:385) ~[dapr-sdk-1.10.0.jar:na]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	*__checkpoint ⇢ Handler com.dotmatics.databricksmanagement.api.controller.DbxUserTokenController#createUserToken(RequestUserTokenDto) [DispatcherHandler]
Original Stack Trace:
		at io.dapr.client.DaprHttp$ResponseFutureCallback.onResponse(DaprHttp.java:385) ~[dapr-sdk-1.10.0.jar:na]
		at org.glowroot.agent.plugin.httpclient.OkHttpCallbackWrapper_.onResponse(OkHttpCallbackWrapper.java:59) ~[na:na]
		at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) ~[okhttp-4.10.0.jar:na]
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
		at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]

Can you consider returning a clearer and more specific message or error code to facilitate troubleshooting?

fvitolo avatar Nov 17 '23 09:11 fvitolo