async function handleError(error, operation) {
if (error.message.includes('cancelled')) {
// User action needed
return { action: 'retry', message: 'Please authenticate' };
}
if (error.message.includes('MAU limit')) {
// App limit
return { action: 'wait', message: 'Limit reached' };
}
if (error.message.includes('network')) {
// Network issue
return { action: 'retry', message: 'Network error' };
}
// Unknown error
console.error(`${operation} failed:`, error);
return { action: 'support', message: 'Please contact support' };
}