mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-31 19:45:15 +02:00
feat(chat): expand error handling for chat operations by introducing a passthrough code set, improving response management and user feedback
This commit is contained in:
parent
1ce122cc99
commit
2a01711bc9
3 changed files with 26 additions and 15 deletions
|
|
@ -227,11 +227,21 @@ function tagPreAcceptSendFailure(error: unknown): unknown {
|
|||
if (error instanceof Error) {
|
||||
const withCode = error as Error & { errorCode?: string; code?: string };
|
||||
const existingCode = withCode.errorCode ?? withCode.code;
|
||||
const passthroughCodes = new Set([
|
||||
"PREMIUM_QUOTA_EXHAUSTED",
|
||||
"THREAD_BUSY",
|
||||
"AUTH_EXPIRED",
|
||||
"UNAUTHORIZED",
|
||||
"RATE_LIMITED",
|
||||
"NETWORK_ERROR",
|
||||
"STREAM_PARSE_ERROR",
|
||||
"TOOL_EXECUTION_ERROR",
|
||||
"PERSIST_MESSAGE_FAILED",
|
||||
"SERVER_ERROR",
|
||||
]);
|
||||
if (
|
||||
existingCode === "THREAD_BUSY" ||
|
||||
existingCode === "AUTH_EXPIRED" ||
|
||||
existingCode === "UNAUTHORIZED" ||
|
||||
existingCode === "RATE_LIMITED"
|
||||
existingCode &&
|
||||
passthroughCodes.has(existingCode)
|
||||
) {
|
||||
return Object.assign(error, { errorCode: existingCode });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue