(type: AppErrorType)
| 66 | * Determines the appropriate recovery strategy for an error type. |
| 67 | */ |
| 68 | export function getRecoveryStrategy(type: AppErrorType): RecoveryStrategy { |
| 69 | switch (type) { |
| 70 | case 'webgl_context_lost': |
| 71 | // WebGL context loss is often recoverable by waiting and retrying |
| 72 | return 'retry'; |
| 73 | case 'webgl_render_error': |
| 74 | // Render errors may require a full reload |
| 75 | return 'reload'; |
| 76 | case 'image_load_error': |
| 77 | // Image errors can often be retried |
| 78 | return 'retry'; |
| 79 | case 'network_error': |
| 80 | // Network errors are usually temporary |
| 81 | return 'retry'; |
| 82 | case 'unknown': |
| 83 | default: |
| 84 | // Unknown errors should be dismissible |
| 85 | return 'dismiss'; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Checks if an error is likely a WebGL context loss event. |
no outgoing calls
no test coverage detected