backend: enhance error handling in apiKeyValidator to handle unexpected errors
This commit is contained in:
parent
6e235d6fa7
commit
ee1e1e34d2
@ -137,7 +137,13 @@ export const apiKeyValidator = async (req: Request) => {
|
|||||||
throw errorInvalidApiKey();
|
throw errorInvalidApiKey();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw errorWithControl(error as OpenViduMeetError, true);
|
if (error instanceof OpenViduMeetError) {
|
||||||
|
throw errorWithControl(error, true);
|
||||||
|
} else {
|
||||||
|
const logger = container.get(LoggerService);
|
||||||
|
logger.error('Error validating API key:', error);
|
||||||
|
throw errorWithControl(internalError('validating API key'), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const userService = container.get(UserService);
|
const userService = container.get(UserService);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user