MCPcopy Create free account
hub / github.com/astercloud/aster / handleProtocolError

Function handleProtocolError

ui/src/protocol/errors.ts:279–306  ·  view source on GitHub ↗
(error: ProtocolError)

Source from the content-addressed store, hash-verified

277 * @returns 是否应该继续执行(true)或中断(false)
278 */
279export 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}

Callers

nothing calls this directly

Calls 2

getErrorHandlingStrategyFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected