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:
parent
17de66140d
commit
c8c107405f
3 changed files with 20 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue