hopefully properly catch this

This commit is contained in:
Sorunome 2020-03-29 11:53:30 +02:00
parent edcf434a48
commit fe939b6d04
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 2 additions and 1 deletions

View File

@ -184,6 +184,7 @@ export class Skype {
});
const MINUTE = 60000;
client.on("error", async (err: Error) => {
const causeName = (err as any).cause ? (err as any).cause.name : "";
log.error("Error when polling");
log.error("name: ", err.name);
const errr = err as any;
@ -195,7 +196,7 @@ export class Skype {
log.error("cause: ", errr.cause);
log.error("data: ", errr.data);
log.error(err);
if (err.name === "UnexpectedHttpStatus") {
if (causeName === "UnexpectedHttpStatus") {
await this.puppet.sendStatusMessage(puppetId, "Error: " + err);
await this.puppet.sendStatusMessage(puppetId, "Reconnecting in a minute... ");
await this.stopClient(puppetId);