Skip to content

Commit

Permalink
Add logging for codeforces API exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzoolee committed Jul 4, 2022
1 parent 599484e commit 4e4050c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/cofo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
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;
const { data } = await axios.get(url);
return data;
} catch (error) {
console.error(error);
logger.exception(error.response.data.comment);
return { status: "FAILED", result: [] };
}
};

0 comments on commit 4e4050c

Please sign in to comment.