MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / onError

Function onError

app/store/chat.ts:498–518  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

496 });
497 },
498 onError(error) {
499 const isAborted = error.message?.includes?.("aborted");
500 botMessage.content +=
501 "\n\n" +
502 prettyObject({
503 error: true,
504 message: error.message,
505 });
506 botMessage.streaming = false;
507 userMessage.isError = !isAborted;
508 botMessage.isError = !isAborted;
509 get().updateTargetSession(session, (session) => {
510 session.messages = session.messages.concat();
511 });
512 ChatControllerPool.remove(
513 session.id,
514 botMessage.id ?? messageIndex,
515 );
516
517 console.error("[Chat] failed ", error);
518 },
519 onController(controller) {
520 // collect controller for stop/retry
521 ChatControllerPool.addController(

Callers

nothing calls this directly

Calls 3

prettyObjectFunction · 0.90
errorMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected