Centralized errors and added their translations. Didn't test

This commit is contained in:
2024-10-31 06:33:57 +03:00
parent 47e90764e7
commit 7a2ab7dd5b
26 changed files with 543 additions and 359 deletions

View File

@@ -2,23 +2,23 @@ import config from '../../config.json' with {type: "json"};
const debug = (text) => {
if (config.debug) console.debug(`[D] [${Date()}]: ${text}`);
}
};
const info = (text) => {
console.log(`[I] [${Date()}]: ${text}`);
}
};
const error = (text) => {
console.error(`[E] [${Date()}]: ${text}`);
}
};
const warn = (text) => {
console.warn(`[W] [${Date()}]: ${text}`);
}
};
const unknownError = (text) => {
error(text);
return "Unknown server error. Please, report to the developer";
}
};
export default { debug, info, error, warn, unknownError };