/**
 * Clean error messages from Electron IPC prefix
 * Transforms: "Error invoking remote method 'channel': Error: Message"
 * Into: "Message"
 */
export function cleanErrorMessage(error: unknown): string {
    if (error instanceof Error) {
        return error.message.replace(/^Error invoking remote method '[^']+': Error: /, '');
    }
    if (typeof error === 'string') {
        return error.replace(/^Error invoking remote method '[^']+': Error: /, '');
    }
    return 'An unknown error occurred';
}
