mirror of
https://github.com/owainwilliams/umbPublisher.git
synced 2026-07-22 13:00:24 +00:00
Removes excessive console logs throughout the codebase to improve readability and reduce noise in the console during operation.
19 lines
No EOL
556 B
TypeScript
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));
|
|
}
|
|
} |