From 4d76fdaee0d899318271546c3074b809f155b4cb Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 17 Apr 2024 11:09:11 -0400 Subject: [PATCH] cubeviz spectral extraction: send exceptions to snackbar (#2807) * send exceptions to snackbar * still should aim to *prevent* errors by disabling the button, whenever possible, but this can catch any remaining exceptions instead of burying them. * changelog entry --- CHANGES.rst | 2 ++ .../plugins/spectral_extraction/spectral_extraction.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b0efc9ec08..2e60768a29 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -73,6 +73,8 @@ Bug Fixes Cubeviz ^^^^^^^ +- Spectral extraction errors will show in snackbar. [#2807] + Imviz ^^^^^ diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index 764e0cb7ac..ed87d1568c 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -415,7 +415,12 @@ def get_aperture(self): return mask_weights def vue_spectral_extraction(self, *args, **kwargs): - self.collapse_to_spectrum(add_data=True) + try: + self.collapse_to_spectrum(add_data=True) + except Exception as e: + self.hub.broadcast(SnackbarMessage( + f"Extraction failed: {repr(e)}", + sender=self, color="error")) def vue_save_as_fits(self, *args): self._save_extracted_spec_to_fits()