Skip to content

Commit b0a71f8

Browse files
committed
Better error message for invalid trace_id
1 parent 3836d34 commit b0a71f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

requake/waveforms/station_metadata.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,13 @@ def get_traceid_coords(orig_time=None):
251251
if config.args.traceid is not None:
252252
traceid_list.append(config.args.traceid)
253253
for trace_id in traceid_list:
254-
net, sta, loc, chan = trace_id.split('.')
254+
try:
255+
net, sta, loc, chan = trace_id.split('.')
256+
except ValueError as err:
257+
raise MetadataMismatchError(
258+
f'Invalid trace_id: {trace_id}. Must be in the format '
259+
'NET.STA.LOC.CHAN'
260+
) from err
255261
net = net or '@@'
256262
coords = _fetch_coordinates(net, sta, loc, chan, orig_time)
257263
if coords is None:

0 commit comments

Comments
 (0)