Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Print error message and skip line
Thorsten Ball802a7f5b9e08
diff --git a/script/histogram b/script/histogramindex 3a499066dee..32db95134e8 100755--- a/script/histogram+++ b/script/histogram@@ -28,7 +28,7 @@ def parse_log_file(file_path):data = {'measurement': [], 'time': [], 'unit': [], 'log_file': []}with open(file_path, 'r') as file:for line in file:- if 'duration:' not in line:+ if ':' not in line:continueparts = line.strip().split(': ')@@ -41,7 +41,8 @@ def parse_log_file(file_path):elif 'µs' in time_with_unit:time, unit = time_with_unit[:-2], 'µs'else:- raise ValueError(f"Invalid time unit in line: {line.strip()}")+ # Print an error message if we can't parse the line and then continue with rest.+ print(f'Error: Invalid time unit in line "{line.strip()}". Skipping.', file=sys.stderr)continuedata['measurement'].append(measurement)