Skip to content

Commit 76b832d

Browse files
authored
fix: wrong error context (#5291)
* fix: wrong error context Signed-off-by: Frost Ming <me@frostming.com> * fix: error Signed-off-by: Frost Ming <me@frostming.com>
1 parent e7c2005 commit 76b832d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/bentoml/_internal/service/loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def load(
401401
except (NotFound, ImportServiceError) as e2:
402402
raise ImportServiceError(
403403
f"Failed to load bento or import service '{bento_identifier}'.\n"
404-
f"If you are attempting to import bento in local store: '{e1}'.\n"
405-
f"If you are importing by python module path: '{e2}'."
404+
f"If you are attempting to import bento by tag: '{e2}'.\n"
405+
f"If you are importing by python module path: '{e1}'."
406406
) from e2
407407
return svc

src/bentoml/_internal/store.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,14 @@ def get(self, tag: t.Union[Tag, str]) -> Item:
158158
matches = self._fs.glob(f"{path}*/")
159159
counts = matches.count().directories
160160
if counts == 0:
161+
cmd = (
162+
"bentoml pull"
163+
if self._item_type.get_typename() == "Model"
164+
else "bentoml models pull"
165+
)
161166
raise NotFound(
162167
f"{self._item_type.get_typename()} '{tag}' is not found in BentoML store {self._fs}, "
163-
"you may need to run `bentoml models pull` first"
168+
f"you may need to run `{cmd}` first"
164169
)
165170
elif counts == 1:
166171
match = next(iter(matches))

0 commit comments

Comments
 (0)