diff --git a/dev/devicelab/lib/tasks/microbenchmarks.dart b/dev/devicelab/lib/tasks/microbenchmarks.dart index 81dd71ed7a..6def31a483 100644 --- a/dev/devicelab/lib/tasks/microbenchmarks.dart +++ b/dev/devicelab/lib/tasks/microbenchmarks.dart @@ -127,7 +127,12 @@ Future> _readJsonResults(Process process) { jsonStarted = false; processWasKilledIntentionally = true; process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically - completer.complete(json.decode(jsonBuf.toString())); + final String jsonOutput = jsonBuf.toString(); + try { + completer.complete(json.decode(jsonOutput)); + } catch (ex) { + completer.completeError('Decoding JSON failed ($ex). JSON string was: $jsonOutput'); + } return; }