Skip to content

Commit

Permalink
Let widget driver send error details
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Nov 1, 2024
1 parent 23613ac commit 0118df0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/stores/widgets/StopGapWidgetDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import {
Capability,
EventDirection,
IMatrixApiError as IWidgetMatrixError,

Check failure on line 12 in src/stores/widgets/StopGapWidgetDriver.ts

View workflow job for this annotation

GitHub Actions / Typescript Syntax Check

Module '"matrix-widget-api"' has no exported member 'IMatrixApiError'.
IOpenIDCredentials,
IOpenIDUpdate,
ISendDelayedEventDetails,
Expand All @@ -33,6 +34,7 @@ import {
ITurnServer as IClientTurnServer,
EventType,
IContent,
MatrixError,
MatrixEvent,
Room,
Direction,
Expand Down Expand Up @@ -689,4 +691,15 @@ export class StopGapWidgetDriver extends WidgetDriver {
const blob = await response.blob();
return { file: blob };
}

/**
* Expresses a {@link MatrixError} as a {@link IWidgetMatrixError}
* for use by Widget API error responses.
* @param error The error to handle.
* @returns The error expressed as a {@link IWidgetMatrixError},
* or undefined if it is not a {@link MatrixError}.
*/
public processError(error: unknown): IWidgetMatrixError | undefined {
return error instanceof MatrixError ? error.asWidgetApiErrorData() : undefined;

Check failure on line 703 in src/stores/widgets/StopGapWidgetDriver.ts

View workflow job for this annotation

GitHub Actions / Typescript Syntax Check

Property 'asWidgetApiErrorData' does not exist on type 'MatrixError'.
}
}

0 comments on commit 0118df0

Please sign in to comment.