rsocket-js
rsocket-js copied to clipboard
Add support for Custom Error Codes
Motivation
In Java implementation, custom application errors can be thrown using RSocketErrorException.
https://github.com/rsocket/rsocket-java/blob/37fc68c68f4b61d826084330a7b0476a456b63da/rsocket-core/src/main/java/io/rsocket/RSocketErrorException.java#L27
But in Js implementation, there is no way to throw custom Errors, All Js Errors are captured and serialized with the same error code APPLICATION_ERROR.
https://github.com/rsocket/rsocket-js/blob/23da9b0e9377ba52d3294cf4763cbbf3de7ba7b1/packages/rsocket-core/src/RSocketMachine.js#L869-L875
Desired solution
Add custom Error class RSocketError and use its error code in the error frame.