* Determines the type of error based on the error message
(errorMessage: string)
| 225 | * Determines the type of error based on the error message |
| 226 | */ |
| 227 | function determineErrorType(errorMessage: string): LoadErrorType { |
| 228 | const message = errorMessage.toLowerCase(); |
| 229 | if (message.includes('fetch') || message.includes('network') || message.includes('timeout')) { |
| 230 | return 'network'; |
| 231 | } |
| 232 | if (message.includes('auth') || message.includes('token') || message.includes('permission') || message.includes('oauth') || message.includes('not authenticated') || message.includes('/login') || message.includes('console account') || message.includes('403')) { |
| 233 | return 'auth'; |
| 234 | } |
| 235 | if (message.includes('api') || message.includes('rate limit') || message.includes('500') || message.includes('529')) { |
| 236 | return 'api'; |
| 237 | } |
| 238 | return 'other'; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Renders error-specific troubleshooting guidance |