UNPKG

symref

Version:

Static code checker for AI code agents (Windsurf, Cline, etc.)

21 lines 783 B
import { LogLevel } from '../types/LogLevel.js'; import { OutputFormatter } from './OutputFormatter.js'; export class ErrorHandler { constructor() { this.formatter = new OutputFormatter(); } handle(error, code = 1) { const timestamp = new Date().toISOString(); const message = error.message; const stackTrace = error.stack; // エラーメッセージを出力 this.formatter.log(`${timestamp} [ERROR] ${message}`, LogLevel.ERROR); // スタックトレースがある場合は出力 if (stackTrace) { this.formatter.log(`${timestamp} [DEBUG] ${stackTrace}`, LogLevel.DEBUG); } // プロセスを終了 process.exit(code); } } //# sourceMappingURL=ErrorHandler.js.map