mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Print error message and skip line
This commit is contained in:
parent
0db9c274aa
commit
802a7f5b9e
1 changed files with 3 additions and 2 deletions
|
@ -28,7 +28,7 @@ def parse_log_file(file_path):
|
||||||
data = {'measurement': [], 'time': [], 'unit': [], 'log_file': []}
|
data = {'measurement': [], 'time': [], 'unit': [], 'log_file': []}
|
||||||
with open(file_path, 'r') as file:
|
with open(file_path, 'r') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
if 'duration:' not in line:
|
if ':' not in line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
parts = line.strip().split(': ')
|
parts = line.strip().split(': ')
|
||||||
|
@ -41,7 +41,8 @@ def parse_log_file(file_path):
|
||||||
elif 'µs' in time_with_unit:
|
elif 'µs' in time_with_unit:
|
||||||
time, unit = time_with_unit[:-2], 'µs'
|
time, unit = time_with_unit[:-2], 'µs'
|
||||||
else:
|
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)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
data['measurement'].append(measurement)
|
data['measurement'].append(measurement)
|
||||||
|
|
Loading…
Reference in a new issue