Skip to content

Commit 9341bf0

Browse files
committed
Don't make error data payload extensible
as this makes it too easy for drivers to put data in the wrong section. Still define the payload type as an interface so that it can be extended in a future version of the API. Also don't use a subfield now that non-extensibility makes the format of the details fields unambiguous.
1 parent 9ea19f6 commit 9341bf0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ClientWidgetApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,11 @@ export class ClientWidgetApi extends EventEmitter {
833833
}
834834

835835
private handleDriverError(e: unknown, request: IWidgetApiRequest, message: string) {
836-
const errorDetails = this.driver.processError(e);
836+
const data = this.driver.processError(e);
837837
this.transport.reply<IWidgetApiErrorResponseData>(request, {
838838
error: {
839839
message,
840-
...errorDetails,
840+
...data,
841841
},
842842
});
843843
}

src/interfaces/IWidgetApiErrorResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface IMatrixApiError {
3434
} & IWidgetApiResponseData; // extensible
3535
}
3636

37-
export interface IWidgetApiErrorResponseDataDetails extends IWidgetApiResponseData {
37+
export interface IWidgetApiErrorResponseDataDetails {
3838
/** Set if the error came from a Matrix API request made by a widget driver */
3939
matrix_api_error?: IMatrixApiError; // eslint-disable-line camelcase
4040
}

0 commit comments

Comments
 (0)