kalix-javascript-sdk icon indicating copy to clipboard operation
kalix-javascript-sdk copied to clipboard

Errors vs failures and logging

Open johanandren opened this issue 3 years ago • 0 comments

Not sure what is the expected behavior in general by JS/TS devs but in the Java SDK we treat a .failure(...) response as a validation error or expected failure that you only want returned to the user, while an thrown exception/error is something unexpected that we log as an error and return something like an "Internal Server Error" response to the user (not leaking service internal details).

The JS SDK currently handles both these cases the same, logging at debug and returning a failure response of the error turned into string: https://github.com/lightbend/akkaserverless-javascript-sdk/blob/main/sdk/src/action-support.js#L369

We should probably revisit this. And also align the error handling of the different components.

johanandren avatar Feb 22 '22 16:02 johanandren