Skip to content

Commit 0118df0

Browse files
committed
Let widget driver send error details
1 parent 23613ac commit 0118df0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/stores/widgets/StopGapWidgetDriver.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {
1010
Capability,
1111
EventDirection,
12+
IMatrixApiError as IWidgetMatrixError,
1213
IOpenIDCredentials,
1314
IOpenIDUpdate,
1415
ISendDelayedEventDetails,
@@ -33,6 +34,7 @@ import {
3334
ITurnServer as IClientTurnServer,
3435
EventType,
3536
IContent,
37+
MatrixError,
3638
MatrixEvent,
3739
Room,
3840
Direction,
@@ -689,4 +691,15 @@ export class StopGapWidgetDriver extends WidgetDriver {
689691
const blob = await response.blob();
690692
return { file: blob };
691693
}
694+
695+
/**
696+
* Expresses a {@link MatrixError} as a {@link IWidgetMatrixError}
697+
* for use by Widget API error responses.
698+
* @param error The error to handle.
699+
* @returns The error expressed as a {@link IWidgetMatrixError},
700+
* or undefined if it is not a {@link MatrixError}.
701+
*/
702+
public processError(error: unknown): IWidgetMatrixError | undefined {
703+
return error instanceof MatrixError ? error.asWidgetApiErrorData() : undefined;
704+
}
692705
}

0 commit comments

Comments
 (0)