@@ -121,32 +121,45 @@ class Debugger extends Domain {
121
121
/// Note that stepping will automatically continue until Chrome is paused at
122
122
/// a location for which we have source information.
123
123
Future <Success > resume ({String ? step, int ? frameIndex}) async {
124
- if (frameIndex != null ) {
125
- throw ArgumentError ('FrameIndex is currently unsupported.' );
126
- }
127
- WipResponse ? result;
128
- if (step != null ) {
129
- _isStepping = true ;
130
- switch (step) {
131
- case 'Over' :
132
- result = await _remoteDebugger.stepOver ();
133
- break ;
134
- case 'Out' :
135
- result = await _remoteDebugger.stepOut ();
136
- break ;
137
- case 'Into' :
138
- result = await _remoteDebugger.stepInto ();
139
- break ;
140
- default :
141
- throwInvalidParam ('resume' , 'Unexpected value for step: $step ' );
124
+ try {
125
+ if (frameIndex != null ) {
126
+ throw ArgumentError ('FrameIndex is currently unsupported.' );
142
127
}
143
- } else {
144
- _isStepping = false ;
145
- _previousSteppingLocation = null ;
146
- result = await _remoteDebugger.resume ();
128
+ WipResponse ? result;
129
+ if (step != null ) {
130
+ _isStepping = true ;
131
+ switch (step) {
132
+ case 'Over' :
133
+ result = await _remoteDebugger.stepOver ();
134
+ break ;
135
+ case 'Out' :
136
+ result = await _remoteDebugger.stepOut ();
137
+ break ;
138
+ case 'Into' :
139
+ result = await _remoteDebugger.stepInto ();
140
+ break ;
141
+ default :
142
+ throwInvalidParam ('resume' , 'Unexpected value for step: $step ' );
143
+ }
144
+ } else {
145
+ _isStepping = false ;
146
+ _previousSteppingLocation = null ;
147
+ result = await _remoteDebugger.resume ();
148
+ }
149
+ handleErrorIfPresent (result);
150
+ return Success ();
151
+ } on WipError catch (e) {
152
+ final errorMessage = e.message;
153
+ if (errorMessage != null &&
154
+ errorMessage.contains ('Can only perform operation while paused' )) {
155
+ throw RPCError (
156
+ 'resume' ,
157
+ RPCErrorKind .kIsolateMustBePaused.code,
158
+ errorMessage,
159
+ );
160
+ }
161
+ rethrow ;
147
162
}
148
- handleErrorIfPresent (result);
149
- return Success ();
150
163
}
151
164
152
165
/// Returns the current Dart stack for the paused debugger.
0 commit comments