🧑‍💻 refactor: Display Client-facing Errors (#2476)

* fix(Google): allow presets to configure expected maxOutputTokens

* refactor: standardize client-facing errors

* refactor(checkUserKeyExpiry): pass endpoint instead of custom message

* feat(UserService): JSDocs and getUserKeyValues

* refactor: add NO_BASE_URL error type, make use of getUserKeyValues, throw user-specific errors

* ci: update tests with recent changes
This commit is contained in:
Danny Avila 2024-04-21 08:31:54 -04:00 committed by GitHub
parent 6db91978ca
commit c937b8cd07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 343 additions and 149 deletions

View file

@ -117,7 +117,9 @@ const handleAbortError = async (res, req, error, data) => {
);
}
const errorText = 'An error occurred while processing your request. Please contact the Admin.';
const errorText = error?.message?.includes('"type"')
? error.message
: 'An error occurred while processing your request. Please contact the Admin.';
const respondWithError = async (partialText) => {
let options = {

View file

@ -1,4 +1,5 @@
const axios = require('axios');
const { ErrorTypes } = require('librechat-data-provider');
const denyRequest = require('./denyRequest');
const { logger } = require('~/config');
@ -24,7 +25,7 @@ async function moderateText(req, res, next) {
const flagged = results.some((result) => result.flagged);
if (flagged) {
const type = 'moderation';
const type = ErrorTypes.MODERATION;
const errorMessage = { type };
return await denyRequest(req, res, errorMessage);
}