File tree Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -833,11 +833,11 @@ export class ClientWidgetApi extends EventEmitter {
833833 }
834834
835835 private handleDriverError ( e : unknown , request : IWidgetApiRequest , message : string ) {
836- const matrixApiError = this . driver . processError ( e ) ;
836+ const errorDetails = this . driver . processError ( e ) ;
837837 this . transport . reply < IWidgetApiErrorResponseData > ( request , {
838838 error : {
839839 message,
840- ...( matrixApiError && { matrix_api_error : { ... matrixApiError } } ) ,
840+ ...errorDetails ,
841841 } ,
842842 } ) ;
843843 }
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ import {
1919 IOpenIDCredentials ,
2020 OpenIDRequestState ,
2121 SimpleObservable ,
22- IMatrixApiError ,
2322 IRoomEvent ,
2423 IRoomAccountData ,
2524 ITurnServer ,
25+ IWidgetApiErrorResponseDataDetails ,
2626 UpdateDelayedEventAction ,
2727} from ".." ;
2828
@@ -361,13 +361,12 @@ export abstract class WidgetDriver {
361361 }
362362
363363 /**
364- * Expresses an error thrown by a Matrix API request made by this driver
365- * in a format compatible with the Widget API.
364+ * Expresses an error thrown by this driver in a format compatible with the Widget API.
366365 * @param error The error to handle.
367- * @returns The error expressed as a {@link IMatrixApiError },
366+ * @returns The error expressed as a {@link IWidgetApiErrorResponseDataDetails },
368367 * or undefined if it cannot be expressed as one.
369368 */
370- public processError ( error : unknown ) : IMatrixApiError | undefined {
369+ public processError ( error : unknown ) : IWidgetApiErrorResponseDataDetails | undefined {
371370 return undefined ;
372371 }
373372}
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import {
3636 ISendEventFromWidgetActionRequest ,
3737 IUpdateDelayedEventFromWidgetActionRequest ,
3838 IUploadFileActionFromWidgetActionRequest ,
39+ IWidgetApiErrorResponseDataDetails ,
3940 UpdateDelayedEventAction ,
4041} from '../src' ;
4142import { IGetMediaConfigActionFromWidgetActionRequest } from '../src/interfaces/GetMediaConfigAction' ;
@@ -70,15 +71,17 @@ class CustomMatrixError extends Error {
7071 }
7172}
7273
73- function processCustomMatrixError ( e : unknown ) : IMatrixApiError | undefined {
74+ function processCustomMatrixError ( e : unknown ) : IWidgetApiErrorResponseDataDetails | undefined {
7475 return e instanceof CustomMatrixError ? {
75- http_status : e . httpStatus ,
76- http_headers : { } ,
77- url : '' ,
78- response : {
79- errcode : e . name ,
80- error : e . message ,
81- ...e . data ,
76+ matrix_api_error : {
77+ http_status : e . httpStatus ,
78+ http_headers : { } ,
79+ url : '' ,
80+ response : {
81+ errcode : e . name ,
82+ error : e . message ,
83+ ...e . data ,
84+ } ,
8285 } ,
8386 } : undefined ;
8487}
You can’t perform that action at this time.
0 commit comments