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
pull/28422/head
Andrew Ferrazzutti 2024-11-11 11:39:17 -05:00 committed by GitHub
parent 17de66140d
commit c8c107405f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 7 deletions

View File

@ -127,7 +127,7 @@
"matrix-encrypt-attachment": "^1.0.3",
"matrix-events-sdk": "0.0.1",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-widget-api": "^1.9.0",
"matrix-widget-api": "^1.10.0",
"memoize-one": "^6.0.0",
"oidc-client-ts": "^3.0.1",
"opus-recorder": "^8.0.3",

View File

@ -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;
}
}

View File

@ -8309,7 +8309,7 @@ matrix-events-sdk@0.0.1:
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop":
version "34.10.0"
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/5a1488ebd5552817b1e95265afe7b3baac1231a2"
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/6855ace6422082d173438cb23368d2fabc6a1086"
dependencies:
"@babel/runtime" "^7.12.5"
"@matrix-org/matrix-sdk-crypto-wasm" "^9.0.0"
@ -8320,7 +8320,7 @@ matrix-events-sdk@0.0.1:
jwt-decode "^4.0.0"
loglevel "^1.7.1"
matrix-events-sdk "0.0.1"
matrix-widget-api "^1.8.2"
matrix-widget-api "^1.10.0"
oidc-client-ts "^3.0.1"
p-retry "4"
sdp-transform "^2.14.1"
@ -8345,10 +8345,10 @@ matrix-web-i18n@^3.2.1:
minimist "^1.2.8"
walk "^2.3.15"
matrix-widget-api@^1.8.2, matrix-widget-api@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-1.9.0.tgz#884136b405bd3c56e4ea285095c9e01ec52b6b1f"
integrity sha512-au8mqralNDqrEvaVAkU37bXOb8I9SCe+ACdPk11QWw58FKstVq31q2wRz+qWA6J+42KJ6s1DggWbG/S3fEs3jw==
matrix-widget-api@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-1.10.0.tgz#d31ea073a5871a1fb1a511ef900b0c125a37bf55"
integrity sha512-rkAJ29briYV7TJnfBVLVSKtpeBrBju15JZFSDP6wj8YdbCu1bdmlplJayQ+vYaw1x4fzI49Q+Nz3E85s46sRDw==
dependencies:
"@types/events" "^3.0.0"
events "^3.2.0"