webdev icon indicating copy to clipboard operation
webdev copied to clipboard

Batched expressions all fail when any subexpression fails

Open biggs0125 opened this issue 1 year ago • 1 comments

Consider the following code:

class A {
  int get foo => 3;
  int get bar => throw 'bad';
}

void main() {
  final a = A();
  debugger(); // <-- stop here
}

Given the shown breakpoint, in DevTools we would expect to be able to expand a and evaluate the subfields of A. We should see something like foo: 3, bar: "Error: bad".

However, dwds tries to batch these expressions and sends a single request to Chrome like [x.foo, x.bar]. This array expression fails to evaluate because one of the subexpressions throws. When the full expression fails, the batch evaluator ends up resolving to an error for every expression in the batch.

DevTools surfaces this as:

Failed to evaluate expression 'x.foo': InternalError: No batch result object ID. 
Failed to evaluate expression 'x.bar': InternalError: No batch result object ID.

Instead we should be showing the correct value for foo and the error thrown for bar.

biggs0125 avatar Dec 20 '24 08:12 biggs0125

@biggs0125 is this resolved now that #2552 has landed?

bkonyi avatar Jan 08 '25 17:01 bkonyi