mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Capture the last rtc transport creation error to sentry
This commit is contained in:
@@ -400,6 +400,7 @@ async function makeTransport(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lastError: Error | undefined = undefined;
|
||||||
// MSC4143: Attempt to fetch transports from backend.
|
// MSC4143: Attempt to fetch transports from backend.
|
||||||
// TODO: Workaround for an issue in the js-sdk RoomWidgetClient that
|
// TODO: Workaround for an issue in the js-sdk RoomWidgetClient that
|
||||||
// is not yet implementing _unstable_getRTCTransports properly (via widget API new action).
|
// is not yet implementing _unstable_getRTCTransports properly (via widget API new action).
|
||||||
@@ -423,6 +424,7 @@ async function makeTransport(
|
|||||||
return selectedTransport;
|
return selectedTransport;
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
lastError = ex as Error;
|
||||||
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
||||||
// Expected, this is an unstable endpoint and it's not required.
|
// Expected, this is an unstable endpoint and it's not required.
|
||||||
// There will be expected 404 errors in the console. When we check if synapse supports the endpoint.
|
// There will be expected 404 errors in the console. When we check if synapse supports the endpoint.
|
||||||
@@ -430,6 +432,7 @@ async function makeTransport(
|
|||||||
"Matrix homeserver does not provide any RTC transports via `/rtc/transports` (will retry with well-known.)",
|
"Matrix homeserver does not provide any RTC transports via `/rtc/transports` (will retry with well-known.)",
|
||||||
);
|
);
|
||||||
} else if (ex instanceof FailToGetOpenIdToken) {
|
} else if (ex instanceof FailToGetOpenIdToken) {
|
||||||
|
logger.error(`makeTransport: Failed to validate backend SFU`, ex);
|
||||||
throw ex;
|
throw ex;
|
||||||
} else {
|
} else {
|
||||||
// We got an error that wasn't just missing support for the feature, so log it loudly.
|
// We got an error that wasn't just missing support for the feature, so log it loudly.
|
||||||
@@ -453,9 +456,20 @@ async function makeTransport(
|
|||||||
const wellKnownFoci = (await AutoDiscovery.getRawClientConfig(domain))?.[
|
const wellKnownFoci = (await AutoDiscovery.getRawClientConfig(domain))?.[
|
||||||
FOCI_WK_KEY
|
FOCI_WK_KEY
|
||||||
];
|
];
|
||||||
const selectedTransport = Array.isArray(wellKnownFoci)
|
let selectedTransport: LocalTransportWithSFUConfig | null = null;
|
||||||
? await getFirstUsableTransport(wellKnownFoci)
|
if (Array.isArray(wellKnownFoci)) {
|
||||||
: null;
|
try {
|
||||||
|
selectedTransport = await getFirstUsableTransport(wellKnownFoci);
|
||||||
|
} catch (ex) {
|
||||||
|
lastError = ex as Error;
|
||||||
|
if (ex instanceof FailToGetOpenIdToken) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
logger.error(`makeTransport: Failed to validate .well-known SFU`, ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedTransport = null;
|
||||||
|
}
|
||||||
if (selectedTransport) {
|
if (selectedTransport) {
|
||||||
logger.info("Using .well-known SFU", selectedTransport);
|
logger.info("Using .well-known SFU", selectedTransport);
|
||||||
return selectedTransport;
|
return selectedTransport;
|
||||||
@@ -477,10 +491,11 @@ async function makeTransport(
|
|||||||
if (ex instanceof FailToGetOpenIdToken) {
|
if (ex instanceof FailToGetOpenIdToken) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
lastError = ex as Error;
|
||||||
logger.error("Failed to validate config SFU", ex);
|
logger.error("Failed to validate config SFU", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we do not have returned a transport by now we throw an error
|
// If we do not have returned a transport by now we throw an error
|
||||||
throw new MatrixRTCTransportMissingError(domain ?? "");
|
throw new MatrixRTCTransportMissingError(domain ?? "", lastError);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ export class MatrixRTCTransportMissingError extends ElementCallError {
|
|||||||
/**
|
/**
|
||||||
* Creates an instance of MatrixRTCTransportMissingError.
|
* Creates an instance of MatrixRTCTransportMissingError.
|
||||||
* @param domain - The domain where the MatrixRTC transport is missing.
|
* @param domain - The domain where the MatrixRTC transport is missing.
|
||||||
|
* @param cause - The underlying error that caused the missing transport.
|
||||||
*/
|
*/
|
||||||
public constructor(domain: string) {
|
public constructor(domain: string, cause?: Error) {
|
||||||
super(
|
super(
|
||||||
t("error.call_is_not_supported"),
|
t("error.call_is_not_supported"),
|
||||||
ErrorCode.MISSING_MATRIX_RTC_TRANSPORT,
|
ErrorCode.MISSING_MATRIX_RTC_TRANSPORT,
|
||||||
@@ -78,6 +79,7 @@ export class MatrixRTCTransportMissingError extends ElementCallError {
|
|||||||
brand: import.meta.env.VITE_PRODUCT_NAME || "Element Call",
|
brand: import.meta.env.VITE_PRODUCT_NAME || "Element Call",
|
||||||
errorCode: ErrorCode.MISSING_MATRIX_RTC_TRANSPORT,
|
errorCode: ErrorCode.MISSING_MATRIX_RTC_TRANSPORT,
|
||||||
}),
|
}),
|
||||||
|
cause,
|
||||||
);
|
);
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user