forgot string.replace doesn't actually mutate the string

This commit is contained in:
nai-degen 2023-05-06 09:55:59 -05:00
parent 119c2f827a
commit e541a7b892
1 changed files with 6 additions and 1 deletions

View File

@ -294,7 +294,12 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async (
}
// Some OAI errors contain the organization ID, which we don't want to reveal.
errorPayload.message?.replace(/org-.{24}/gm, "org-xxxxxxxxxxxxxxxxxxx");
if (errorPayload.error?.message) {
errorPayload.error.message = errorPayload.error.message.replace(
/org-.{24}/gm,
"org-xxxxxxxxxxxxxxxxxxx"
);
}
res.status(statusCode).json(errorPayload);
throw new Error(errorPayload.error?.message);