File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,7 @@ export class RestClient {
6262 * @param {RequestArgument[] } requestArguments An array of request arguments.
6363 * @return {Promise<ReturnData | null> } The result of the request, or null if the response status is 404.
6464 */
65- async execute < ReturnData extends Record < string , unknown > = any > (
66- method : RequestMethod ,
67- path : string ,
68- requestArguments : RequestArgument [ ] = [ ]
69- ) {
65+ async execute < ReturnData = any > ( method : RequestMethod , path : string , requestArguments : RequestArgument [ ] = [ ] ) {
7066 while ( path . startsWith ( '/' ) ) {
7167 path = path . substring ( 1 ) ;
7268 }
@@ -124,7 +120,10 @@ export class RestClient {
124120 }
125121
126122 if ( result . status >= 400 ) {
127- const error = ( output ?. error ?? 'Unknown error' ) as string ;
123+ const error =
124+ output && typeof output === 'object' && 'error' in output && typeof output . error === 'string'
125+ ? output . error
126+ : 'Unknown error' ;
128127 throw new RestError ( error , result ) ;
129128 }
130129
You can’t perform that action at this time.
0 commit comments