Skip to content

Commit c9b036e

Browse files
committed
🔊 fix: migrate webhook errors to internal logger #2444
1 parent bf49894 commit c9b036e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/api/Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3829,7 +3829,7 @@ public async getStatus(contactId: ContactId) : Promise<{
38293829
const t = (now() - whStart).toFixed(0);
38303830
log.info("Client Webhook", event, status, t)
38313831
})
3832-
.catch(err=>console.error(`WEBHOOK ERROR: `, url ,err.message))
3832+
.catch(err=>log.error(`WEBHOOK ERROR: `, url ,err.message))
38333833
}
38343834
))),10000);
38353835
}

src/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ready: (config : any) => Promise<void> = async (config : any) => {
2424
sessionId: config.sessionId,
2525
namespace: "READY"
2626
}
27-
}).catch(err => console.error(`WEBHOOK ERROR: ${config.readyWebhook} ${err.message}`));
27+
}).catch(err => log.error(`WEBHOOK ERROR: ${config.readyWebhook} ${err.message}`));
2828
}
2929

3030
async function start() {
@@ -75,7 +75,7 @@ async function start() {
7575
}).then(({status})=>{
7676
const t = (now() - whStart).toFixed(0);
7777
log.info("EV Webhook", namespace, status, t)
78-
}).catch(err => console.error(`WEBHOOK ERROR: ${cliConfig.ev} ${err.message}`));
78+
}).catch(err => log.error(`WEBHOOK ERROR: ${cliConfig.ev} ${err.message}`));
7979
})
8080
}
8181
//These things can be done before the client is created

src/cli/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import robots from "express-robots-txt";
66
import swaggerUi from 'swagger-ui-express';
77
import { default as axios } from 'axios'
88
import parseFunction from 'parse-function';
9-
import { Client, ev, SimpleListener, ChatId, Message } from '..';
9+
import { Client, ev, SimpleListener, ChatId, Message, log } from '..';
1010
import qs from 'qs';
1111
import { convert } from 'xmlbuilder2';
1212
import { chatwootMiddleware, setupChatwootOutgoingMessageHandler } from './integrations/chatwoot';
@@ -211,7 +211,7 @@ export const setupTwilioCompatibleWebhook : (cliConfig : cliFlags, client: Clien
211211
}
212212
return await client.sendText(message.from, msg['#'])
213213
} catch (error) {
214-
console.error("TWILIO-COMPAT WEBHOOK ERROR", url, error.message)
214+
log.error("TWILIO-COMPAT WEBHOOK ERROR", url, error.message)
215215
}
216216
})
217217
}

0 commit comments

Comments
 (0)