Skip to content

Commit

Permalink
v.db.addcolumn: Add error message for layer without a table (#2423)
Browse files Browse the repository at this point in the history
* Layer without a table is reported with a specific message instead of the previous message which said there is no connection for the map.
* Message for no connection at all contains name of the map.
  • Loading branch information
wenzeslaus authored Jul 26, 2022
1 parent 37d45fb commit 669baa4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/v.db.addcolumn/v.db.addcolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,18 @@ def main():
try:
f = grass.vector_db(map)[int(layer)]
except KeyError:
if grass.vector_db(map):
grass.fatal(
_(
"There is no table connected to layer <{layer}> of <{name}>. "
"Run v.db.connect or v.db.addtable first."
).format(name=map, layer=layer)
)
grass.fatal(
_(
"There is no table connected to this map. Run v.db.connect or v.db.addtable first."
)
"There is no table connected to <{name}>. "
"Run v.db.connect or v.db.addtable first."
).format(name=map)
)

table = f["table"]
Expand Down

0 comments on commit 669baa4

Please sign in to comment.