mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
15 lines
336 B
TypeScript
15 lines
336 B
TypeScript
export const logError = (message: string, error: Error) => {
|
|
window.electronAPI.logs.logError(message, error);
|
|
};
|
|
|
|
export const safeExecute = async <T>(
|
|
operation: () => Promise<T>,
|
|
errorMessage: string
|
|
) => {
|
|
try {
|
|
return operation();
|
|
} catch (error) {
|
|
logError(errorMessage, error as Error);
|
|
return null;
|
|
}
|
|
};
|