generated from nhcarrigan/template
fix: gold icon, story banner crop, crafted items persist, community blurb, validation error filtering
This commit is contained in:
@@ -5,14 +5,22 @@
|
||||
* @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.
|
||||
* Accepts the same arguments as console.error — conventionally a context string
|
||||
* followed by the error value.
|
||||
* @param logArguments - The values to log, forwarded directly to console.error.
|
||||
* 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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user