1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

specify IndexError exception in try/except block

This commit is contained in:
Kelly Brazil
2020-07-10 08:30:31 -07:00
parent 19ace36ffa
commit 780b9b61de

View File

@ -141,9 +141,9 @@ def parse(data, raw=False, quiet=False):
raw_output[key] = value raw_output[key] = value
continue continue
# if there is an exception, then there was no delimiter in the line. In this case # if there is an IndexError exception, then there was no delimiter in the line.
# just append the data line as a value to the previous key. # In this case just append the data line as a value to the previous key.
except Exception: except IndexError:
prior_key = [*raw_output.keys()][-1] prior_key = [*raw_output.keys()][-1]
raw_output[prior_key] = raw_output[prior_key] + '\n' + line raw_output[prior_key] = raw_output[prior_key] + '\n' + line
continue continue