Browse Source

error loggin

Sv443 3 năm trước cách đây
mục cha
commit
a758579c62
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      src/lyrics.js

+ 4 - 3
src/lyrics.js

@@ -1,5 +1,6 @@
 const { default: axios } = require("axios");
 const { default: axios } = require("axios");
 const { getLyrics: apiGetLyrics } = require("genius-lyrics-api");
 const { getLyrics: apiGetLyrics } = require("genius-lyrics-api");
+const error = require("./error");
 
 
 const accessToken = process.env.GENIUS_ACCESS_TOKEN || "ERR_NO_ENV";
 const accessToken = process.env.GENIUS_ACCESS_TOKEN || "ERR_NO_ENV";
 
 
@@ -49,16 +50,16 @@ async function getLyrics(title, artist)
 {
 {
     try
     try
     {
     {
-        return (await apiGetLyrics({
+        return await apiGetLyrics({
             apiKey: accessToken,
             apiKey: accessToken,
             title,
             title,
             artist,
             artist,
             optimizeQuery: true,
             optimizeQuery: true,
-        })) ?? "nullish";
+        });
     }
     }
     catch(err)
     catch(err)
     {
     {
-        return err.toString();
+        error("Error while getting lyrics", err);
     }
     }
 }
 }