deltachat / deltachat-node

Email-based instant messaging for Node.js.
GNU General Public License v3.0
45 stars 11 forks source link

asyncify joinSecurejoin (convert callback to promise) #459

Closed Simon-Laux closed 4 years ago

Simon-Laux commented 4 years ago
// current
joinSecurejoin(code:string, callback:(result:number)=>()):void
// wanted
joinSecurejoin(code:string):Promise<number>

ah while we are already at it, we should add a doc comment stating that the result is the joined chat id.

Why is this urgent?

Because the cb argument is not a real callback (contains no error), also the error on fail is thrown somewhere, but not at the place joinSecurejoin was called. So wrapping the current function in a promise within js is not enough, the throwing of the error needs to be fixed in the napi module as well.

Jikstra commented 4 years ago

There should be no error thrown. join_securejoin on the cffi doesnt throw any errors and only returns an integer. Where should the error come from?