owainwilliams_umbPublisher/services/ErrorHandler.ts
Owain a21b26d4e9 [REF] Removes console logs for clarity
Removes excessive console logs throughout the codebase to improve readability and reduce noise in the console during operation.
2026-02-12 12:31:22 +00:00

19 lines
No EOL
556 B
TypeScript

import { Notice } from 'obsidian';
export class ErrorHandler {
static handle(error: any, context: string = 'Operation'): void {
let message = `${context} failed`;
if (error.message) {
message += `: ${error.message}`;
} else if (typeof error === 'string') {
message += `: ${error}`;
}
new Notice(message);
}
static async handleAsync(error: any, context: string = 'Operation'): Promise<void> {
return Promise.resolve(this.handle(error, context));
}
}