(error: ProtocolError)
| 277 | * @returns 是否应该继续执行(true)或中断(false) |
| 278 | */ |
| 279 | export function handleProtocolError(error: ProtocolError): boolean { |
| 280 | const strategy = getErrorHandlingStrategy(error.code); |
| 281 | |
| 282 | switch (strategy) { |
| 283 | case 'throw': |
| 284 | throw error; |
| 285 | |
| 286 | case 'warn_and_skip': |
| 287 | console.warn(`[ProtocolError] ${error.toString()}`); |
| 288 | return true; |
| 289 | |
| 290 | case 'return_default': |
| 291 | console.warn(`[ProtocolError] ${error.toString()}`); |
| 292 | return true; |
| 293 | |
| 294 | case 'sanitize_and_warn': |
| 295 | console.warn(`[ProtocolError] ${error.toString()}`); |
| 296 | return true; |
| 297 | |
| 298 | case 'return_empty_and_warn': |
| 299 | console.warn(`[ProtocolError] ${error.toString()}`); |
| 300 | return true; |
| 301 | |
| 302 | default: |
| 303 | console.warn(`[ProtocolError] ${error.toString()}`); |
| 304 | return true; |
| 305 | } |
| 306 | } |
nothing calls this directly
no test coverage detected