generated from nhcarrigan/template
66413c5e21
Wrap all async API route handlers and services in try/catch blocks, piping errors to the @nhcarrigan/logger telemetry service. Add a frontend logError utility, React ErrorBoundary, and overridden console to forward all unhandled client-side errors to the backend telemetry endpoint.
20 lines
666 B
TypeScript
20 lines
666 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 */
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
const logError = (...logArguments: Array<unknown>): void => {
|
|
console.error(...logArguments);
|
|
};
|
|
|
|
export { logError };
|