- Updated error handling in videoProcessor.js, videoProcessorWebGL.js, videoSync.js, viewerInstanceManager.js, and various utility files to log caught exceptions using console.debug. - Introduced a new script to automate the replacement of silent catch blocks with logging statements. - Enhanced safety checks in the database schema and transaction manager to prevent SQL injection vulnerabilities. - Added regex patterns for validating column definitions and executable names in the ExifTool adapter. - Improved error handling in health and filesystem routes to ensure better feedback on invalid inputs. - Added tests to cover new error handling and validation logic.
19 lines
704 B
JavaScript
19 lines
704 B
JavaScript
import { APP_CONFIG } from "../app/config.js";
|
|
import { comfyToast } from "../app/toast.js";
|
|
|
|
export function reportError(err, context = "Majoor", { showToast = false, toastType = "error" } = {}) {
|
|
const message = err?.message || String(err || "Unknown error");
|
|
try {
|
|
if (APP_CONFIG.DEBUG_VERBOSE_ERRORS) {
|
|
console.error(`[Majoor][${context}]`, message, err);
|
|
} else {
|
|
console.debug(`[Majoor][${context}]`, message);
|
|
}
|
|
} catch (e) { console.debug?.(e); }
|
|
if (showToast && APP_CONFIG.DEBUG_VERBOSE_ERRORS) {
|
|
try {
|
|
comfyToast(`${context}: ${message}`, toastType, 4000);
|
|
} catch (e) { console.debug?.(e); }
|
|
}
|
|
}
|