@@ -885,20 +885,32 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
885885 String ? step,
886886 int ? frameIndex,
887887 }) async {
888- if (inspector.appConnection.isStarted) {
889- return captureElapsedTime (
890- () async {
891- await isInitialized;
892- await isStarted;
893- _checkIsolate ('resume' , isolateId);
894- return await (await debuggerFuture)
895- .resume (step: step, frameIndex: frameIndex);
896- },
897- (result) => DwdsEvent .resume (step),
898- );
899- } else {
900- inspector.appConnection.runMain ();
901- return Success ();
888+ try {
889+ if (inspector.appConnection.isStarted) {
890+ return captureElapsedTime (
891+ () async {
892+ await isInitialized;
893+ await isStarted;
894+ _checkIsolate ('resume' , isolateId);
895+ return await (await debuggerFuture)
896+ .resume (step: step, frameIndex: frameIndex);
897+ },
898+ (result) => DwdsEvent .resume (step),
899+ );
900+ } else {
901+ inspector.appConnection.runMain ();
902+ return Success ();
903+ }
904+ } on WipError catch (e) {
905+ final errorMessage = e.message;
906+ if (errorMessage != null &&
907+ errorMessage.contains ('Can only perform operation while paused' )) {
908+ // TODO(https://github.com/dart-lang/sdk/issues/52636): Use error code
909+ // from package:vm_service.
910+ const kIsolateMustBePausedCode = 106 ;
911+ throw RPCError ('resume' , kIsolateMustBePausedCode, errorMessage);
912+ }
913+ rethrow ;
902914 }
903915 }
904916
0 commit comments