Let widget driver send error details (#28357)
* Let widget driver send error details * Match new widget API types * Don't @link across packages in case web documentation generation disallows it. * Update matrix-widget-api * Update matrix-js-sdk Include matrix-org/matrix-js-sdk#4507 to fix playwright CI
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
WidgetDriver,
|
||||
WidgetEventCapability,
|
||||
WidgetKind,
|
||||
IWidgetApiErrorResponseDataDetails,
|
||||
ISearchUserDirectoryResult,
|
||||
IGetMediaConfigResult,
|
||||
UpdateDelayedEventAction,
|
||||
@@ -33,6 +34,7 @@ import {
|
||||
ITurnServer as IClientTurnServer,
|
||||
EventType,
|
||||
IContent,
|
||||
MatrixError,
|
||||
MatrixEvent,
|
||||
Room,
|
||||
Direction,
|
||||
@@ -689,4 +691,15 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||
const blob = await response.blob();
|
||||
return { file: blob };
|
||||
}
|
||||
|
||||
/**
|
||||
* Expresses a {@link MatrixError} as a JSON payload
|
||||
* for use by Widget API error responses.
|
||||
* @param error The error to handle.
|
||||
* @returns The error expressed as a JSON payload,
|
||||
* or undefined if it is not a {@link MatrixError}.
|
||||
*/
|
||||
public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined {
|
||||
return error instanceof MatrixError ? { matrix_api_error: error.asWidgetApiErrorData() } : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user