From 12da2c1c396fa8024f0ec726693c647900ed8d75 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Thu, 19 Dec 2024 15:54:51 -0500 Subject: [PATCH] Raise error if trying to rename a subset that doesn't exist --- jdaviz/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdaviz/app.py b/jdaviz/app.py index 5ba240e8e6..f8278c6eb3 100644 --- a/jdaviz/app.py +++ b/jdaviz/app.py @@ -2061,6 +2061,10 @@ def _rename_subset(self, old_label, new_label, subset_group=None, check_valid=Tr if s.label == old_label: subset_group = s break + # If we couldn't find a matching subset group, raise an error + else: + raise ValueError(f"No subset named {old_label} to rename") + if check_valid: if self._check_valid_subset_label(new_label): subset_group.label = new_label