From 4e4050c352b59569c2520782d80a181c591db635 Mon Sep 17 00:00:00 2001 From: DongZoo Lee Date: Tue, 5 Jul 2022 02:19:24 +0900 Subject: [PATCH] Add logging for codeforces API exceptions --- utils/cofo.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/cofo.js b/utils/cofo.js index 23b737f..4a0575b 100644 --- a/utils/cofo.js +++ b/utils/cofo.js @@ -1,6 +1,8 @@ const cofo = (module.exports = {}); const axios = require("axios"); +const logger = require("./logger"); + cofo.getTier = async (id) => { try { const url = "https://codeforces.com/api/user.info?handles=" + id; @@ -8,6 +10,7 @@ cofo.getTier = async (id) => { return data; } catch (error) { console.error(error); + logger.exception(error.response.data.comment); return { status: "FAILED", result: [] }; } };