trace_processor: handle errors in parsing better

Bug: 132188809
Change-Id: I97b26f7a525255d9cb177827887fd5d799f8c701
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index 7a97020..91b132d 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -617,7 +617,9 @@
     PERFETTO_CHECK(aio_read(&cb) == 0);
 
     // Parse the completed buffer while the async read is in-flight.
-    tp->Parse(std::move(buf), static_cast<size_t>(rsize));
+    bool success = tp->Parse(std::move(buf), static_cast<size_t>(rsize));
+    if (PERFETTO_UNLIKELY(!success))
+      return 1;
   }
   tp->NotifyEndOfFile();