Print a nicer error message when asked to build an empty string ('').
This happens sometimes, for example, if you do whatever | while read x; do redo-ifchange "$x" done and the input contains blank lines. We could ignore the request for blankness, but it seems like that situation might indicate a more serious bug in your parser, so it's probably better to just abort with a meaningful error.
This commit is contained in:
parent
2023d36676
commit
2a936a7574
4 changed files with 12 additions and 2 deletions
3
state.py
3
state.py
|
|
@ -189,8 +189,7 @@ class File(object):
|
|||
row = d.execute(q, l).fetchone()
|
||||
if not row:
|
||||
if not name:
|
||||
raise Exception('File with id=%r not found and '
|
||||
'name not given' % id)
|
||||
raise Exception('No file with id=%r name=%r' % (id, name))
|
||||
try:
|
||||
_write('insert into Files (name) values (?)', [name])
|
||||
except sqlite3.IntegrityError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue