Files
elysium/apps/web/src/utils/logError.ts
T
hikari c494cf9a26
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m4s
CI / Lint, Build & Test (pull_request) Failing after 1m11s
fix: gold icon, story banner crop, crafted items persist, community blurb, validation error filtering
2026-04-06 13:57:32 -07:00

28 lines
972 B
TypeScript

/**
* @file Frontend error logging utility that forwards errors to the backend telemetry service.
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
/* eslint-disable no-console -- Errors are forwarded to backend via the overridden console.error */
import { ValidationError } from "../api/client.js";
/**
* Logs an error to the backend telemetry service.
* ValidationErrors (4xx API rejections) are downgraded to console.warn so they
* are not forwarded to the error-email pipeline — they are expected server responses.
* @param logArguments - The values to log, forwarded directly to console.error or console.warn.
*/
const logError = (...logArguments: Array<unknown>): void => {
const isValidation = logArguments.some((argument) => {
return argument instanceof ValidationError;
});
if (isValidation) {
console.warn(...logArguments);
return;
}
console.error(...logArguments);
};
export { logError };