Skip to content

Commit

Permalink
Better error message for half-initialised working copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
olsen232 committed Sep 7, 2020
1 parent d20f96c commit dfa5805
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sno/working_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from . import gpkg, gpkg_adapter
from .diff_structs import RepoDiff, DatasetDiff, DeltaDiff, Delta
from .exceptions import InvalidOperation, NotYetImplemented
from .exceptions import InvalidOperation, NotYetImplemented, NotFound, NO_WORKING_COPY
from .filter_util import UNFILTERED
from .geometry import Geometry, normalise_gpkg_geom
from .schema import Schema
Expand Down Expand Up @@ -554,7 +554,12 @@ def get_db_tree(self, table_name="*"):
)
row = dbcur.fetchone()
if not row:
raise ValueError(f"No tree entry in state_table for {table_name}")
L.debug(f"No tree entry in state_table for {table_name}")
# This happens if you start trying to use the working copy when it is half written.
raise NotFound(
f"Working copy at {self.path} is not fully initialised",
NO_WORKING_COPY,
)

wc_tree_id = row[0]
return wc_tree_id
Expand Down

0 comments on commit dfa5805

Please sign in to comment.