Skip to content

Commit

Permalink
[main-] improve error messages for invalid start sheets
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Jun 21, 2024
1 parent b8d1689 commit f314271
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion visidata/basesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def getSheet(vd, sheetname):
try:
sheetidx = int(sheetname)
return vd.sheets[sheetidx]
except ValueError:
except (ValueError, IndexError):
pass

if sheetname == 'options':
Expand Down
6 changes: 4 additions & 2 deletions visidata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ def moveToPos(vd, sources, startsheets, startcol, startrow):
rowidx = vs.getRowIndexFromStr(vd.options.rowkey_prefix + subsheet)
if rowidx is None:
vd.warning(f'{vs.name} has no subsheet "{subsheet}"')
vs = None
break
return
vs = vs.rows[rowidx]
if not isinstance(vs, BaseSheet):
vd.warning(f'row {subsheet} for subsheet is not a sheet')
return
vd.options.set('load_lazy', True, obj=vs)
vd.sync(vs.ensureLoaded())
vd.clearCaches()
Expand Down

0 comments on commit f314271

Please sign in to comment.