Hi there. I was totally surprised when my tests failed because the .ready() method threw a string, instead of an Error object. Was it done by purpose?
I'm talking about simple .ready() method usage (example from the documentation):
try {
await client.ready().catch((e) => { throw e; });
// SDK is ready
} catch(e) {
console.log(typeof e);
}
Result: string
I think we can agree it's a bad decision to throw anything except Error, but maybe there is a reason I don't understand.
Anyway, maybe it is worth updating documentation. Or, fix the bug and bump the minor version.
P.S.
Currently, the workaround is to wrap the string manually.
try {
await client.ready().catch((e) => { throw Error(e); });
// SDK is ready
} catch(e) {
console.log(typeof e);
}
Thanks.
Hi there. I was totally surprised when my tests failed because the
.ready()method threw a string, instead of an Error object. Was it done by purpose?I'm talking about simple
.ready()method usage (example from the documentation):Result: string
I think we can agree it's a bad decision to throw anything except Error, but maybe there is a reason I don't understand.
Anyway, maybe it is worth updating documentation. Or, fix the bug and bump the minor version.
P.S.
Currently, the workaround is to wrap the string manually.
Thanks.