Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/charms/operator_libs_linux/v2/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,10 +1288,10 @@ def _wrap_snap_operations(
snaps.append(snap)
except SnapError as e: # noqa: PERF203
logger.warning("Failed to %s snap %s: %s!", op, s, e.message)
errors.append(s)
errors.append(e.message)
except SnapNotFoundError:
logger.warning("Snap '%s' not found in cache!", s)
errors.append(s)
errors.append(f"Snap '{s}' not found in cache!")

if errors:
raise SnapError(f"Failed to install or refresh snap(s): {', '.join(errors)}")
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,10 @@ def __getitem__(self, name: str) -> snap.Snap:
snap.add("nothere")
repr(ctx.exception) # ensure custom __repr__ doesn't error
self.assertEqual("<charms.operator_libs_linux.v2.snap.SnapError>", ctx.exception.name)
self.assertIn("Failed to install or refresh snap(s): nothere", ctx.exception.message)
self.assertIn(
"Failed to install or refresh snap(s): Snap 'nothere' not found in cache!",
ctx.exception.message,
)

def test_snap_get(self):
"""Test the multiple different ways of calling the Snap.get function.
Expand Down
Loading