Add support for throwing errors with custom error code #272
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.
Motivation:
In the rsocket-js implementation (v0 branch), all stream errors are serialized and transmitted to other end with fixed error code. Due to this bug, there is no way to send custom error codes over stream (Bug report #218)
Custom error codes are supported in the rsocket protocol and implemented in rsocket-java this using RSocketErrorException . When the application throws
RSocketErrorExecption
, the error code of the exception is sent over the stream. But this feature is not implemented in rsocket-js.Modifications:
RSocketError
inRSocketError.js
.RSocketError
, theerrorCode
of the error object is sent over the stream.Result:
This will allow application to send custom error codes to other party.