*Wrap err in Error
This commit is contained in:
parent
1fabdc7e4d
commit
2437037a14
|
@ -27,7 +27,7 @@ export class DHT {
|
||||||
public async connect(pubkey: string): Promise<Socket> {
|
public async connect(pubkey: string): Promise<Socket> {
|
||||||
const [resp, err] = await callModule(DHT_MODULE, "connect", { pubkey });
|
const [resp, err] = await callModule(DHT_MODULE, "connect", { pubkey });
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw new Error(err);
|
||||||
}
|
}
|
||||||
return new Socket(resp.id);
|
return new Socket(resp.id);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export class DHT {
|
||||||
public async addRelay(pubkey: string): Promise<void> {
|
public async addRelay(pubkey: string): Promise<void> {
|
||||||
const [, err] = await callModule(DHT_MODULE, "addRelay", { pubkey });
|
const [, err] = await callModule(DHT_MODULE, "addRelay", { pubkey });
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw new Error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue