error management: Handle fail to get JWT token

This commit is contained in:
Valere
2025-03-11 09:07:19 +01:00
parent 343da0db14
commit 04a46ebabe
3 changed files with 32 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ export enum ErrorCode {
/** LiveKit indicates that the server has hit its track limits */
INSUFFICIENT_CAPACITY_ERROR = "INSUFFICIENT_CAPACITY_ERROR",
E2EE_NOT_SUPPORTED = "E2EE_NOT_SUPPORTED",
OPEN_ID_ERROR = "OPEN_ID_ERROR",
UNKNOWN_ERROR = "UNKNOWN_ERROR",
}
@@ -41,7 +42,7 @@ export class ElementCallError extends Error {
localisedTitle: string,
code: ErrorCode,
category: ErrorCategory,
localisedMessage: string,
localisedMessage?: string,
cause?: Error,
) {
super(localisedTitle, { cause });
@@ -105,6 +106,19 @@ export class UnknownCallError extends ElementCallError {
}
}
export class FailToGetOpenIdToken extends ElementCallError {
public constructor(error: Error) {
super(
t("error.generic"),
ErrorCode.OPEN_ID_ERROR,
ErrorCategory.CONFIGURATION_ISSUE,
undefined,
// Properly set it as a cause for a better reporting on sentry
error,
);
}
}
export class InsufficientCapacityError extends ElementCallError {
public constructor() {
super(