client-js icon indicating copy to clipboard operation
client-js copied to clipboard

Can't catch bad response error

Open bufffun opened this issue 3 years ago • 4 comments

When the server response with bad reponse format, how can I catch the error?

client.request({ method: "method" }).then().catch(err){ //can't trigger this }

WX20210115-180433

bufffun avatar Jan 15 '21 10:01 bufffun

Actually didn't realize this was from Jan. I missed this in the pipeline we'll have a quick look

zcstarr avatar Apr 15 '21 23:04 zcstarr

Seems at current you'd have to register an event listener for onError, and handle it there... but it's not catch-able. :thinking:

bradjones1 avatar Feb 09 '22 21:02 bradjones1

Actually... I just tried this and... it works. The promise is rejected with the error, but you can also subscribe to events. Might be stale/can't recreate?

bradjones1 avatar Feb 09 '22 21:02 bradjones1

See also https://github.com/open-rpc/client-js/issues/306

bradjones1 avatar Mar 17 '22 23:03 bradjones1