@@ -137,7 +137,7 @@ export class CoreClientProvider extends GrpcClientProvider<CoreClientProvider.Cl
137
137
) ;
138
138
}
139
139
140
- // Final error codes are not yet defined by the CLI. Hence, we do string match in the error message.
140
+ // Final error codes are not yet defined by the CLI. Hence, we do string matching in the message RPC status .
141
141
private isRpcStatusError (
142
142
error : unknown ,
143
143
assert : ( message : string ) => boolean
@@ -212,26 +212,23 @@ export class CoreClientProvider extends GrpcClientProvider<CoreClientProvider.Cl
212
212
if ( error ) {
213
213
console . error ( error . getMessage ( ) ) ;
214
214
errorStatus . push ( error ) ;
215
- // Cancel the init request. This will result in a cancel error.
215
+ // Cancel the init request. No need to wait until the end of the event. The init has already failed.
216
+ // Canceling the request will result in a cancel error, but we need to reject with the original error later.
216
217
stream . cancel ( ) ;
217
218
}
218
219
} ) ;
219
220
stream . on ( 'error' , ( error ) => {
220
- // on any error during the init request, the request is canceled.
221
- // on cancel, the IDE2 ignores the cancel error and rejects with the original one.
221
+ // On any error during the init request, the request is canceled.
222
+ // On cancel, the IDE2 ignores the cancel error and rejects with the original one.
222
223
reject (
223
224
this . isCancelError ( error ) && errorStatus . length
224
225
? errorStatus [ 0 ]
225
226
: error
226
227
) ;
227
228
} ) ;
228
- stream . on ( 'end' , ( ) => {
229
- if ( errorStatus . length ) {
230
- reject ( errorStatus ) ;
231
- } else {
232
- resolve ( ) ;
233
- }
234
- } ) ;
229
+ stream . on ( 'end' , ( ) =>
230
+ errorStatus . length ? reject ( errorStatus ) : resolve ( )
231
+ ) ;
235
232
} ) ;
236
233
}
237
234
0 commit comments