Generic Commit; Most likely a fix or small feature
This commit is contained in:
16
dist/logger.js
vendored
16
dist/logger.js
vendored
@@ -7,6 +7,8 @@ exports.logError = logError;
|
||||
exports.logWarning = logWarning;
|
||||
exports.logSuccess = logSuccess;
|
||||
exports.logInfo = logInfo;
|
||||
exports.printNetworkError = printNetworkError;
|
||||
const axios_1 = __importDefault(require("axios"));
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
function logError(...args) {
|
||||
console.error(chalk_1.default.red("ERROR:"), ...args);
|
||||
@@ -20,3 +22,17 @@ function logSuccess(...args) {
|
||||
function logInfo(...args) {
|
||||
console.info(chalk_1.default.cyan("INFO:"), ...args);
|
||||
}
|
||||
function printNetworkError(error) {
|
||||
if (axios_1.default.isAxiosError(error)) {
|
||||
logError("Axios error details:", {
|
||||
message: error.message,
|
||||
status: error.response?.status,
|
||||
statusText: error.response?.statusText,
|
||||
data: error.response?.data,
|
||||
url: error.config?.url,
|
||||
});
|
||||
}
|
||||
else {
|
||||
logError("Unexpected error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user