Generic Commit; Most likely a fix or small feature
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import axios from "axios";
|
||||
import chalk from "chalk";
|
||||
|
||||
export function logError(...args: unknown[]) {
|
||||
@@ -15,3 +16,17 @@ export function logSuccess(...args: unknown[]) {
|
||||
export function logInfo(...args: unknown[]) {
|
||||
console.info(chalk.cyan("INFO:"), ...args);
|
||||
}
|
||||
|
||||
export function printNetworkError(error: unknown) {
|
||||
if (axios.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