mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-15 12:47:56 +08:00
fix: improve anndata error msg (#2743)
* feat: improve error message for anndata version mismatches * fix: Remove mentioning of python update and only mention upgrading anndata * Update server/data_anndata/anndata_adaptor.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -173,13 +173,24 @@ class AnndataAdaptor(DataAdaptor):
|
||||
)
|
||||
except MemoryError:
|
||||
raise DatasetAccessError("Out of memory - file is too large for available memory.")
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
import traceback
|
||||
error_msg = str(e)
|
||||
|
||||
# IMPROVEMENT: Broadly catch ANY version incompatibility
|
||||
if "No read method registered" in error_msg and "IOSpec" in error_msg:
|
||||
message = (
|
||||
"Error loading file: This H5AD file uses a newer internal format that "
|
||||
"your version of 'anndata' cannot read.\n"
|
||||
f"The specific error was: {error_msg}\n"
|
||||
"Please upgrade anndata in your environment (pip install --upgrade anndata)."
|
||||
)
|
||||
else:
|
||||
message = (
|
||||
"File not found or is inaccessible. File must be an .h5ad object. "
|
||||
"Please check your input and try again."
|
||||
)
|
||||
|
||||
message = (
|
||||
"File not found or is inaccessible. File must be an .h5ad object. "
|
||||
"Please check your input and try again."
|
||||
)
|
||||
if self.server_config.app__verbose:
|
||||
message += f"\n{traceback.format_exc()}"
|
||||
raise DatasetAccessError(message)
|
||||
|
||||
Reference in New Issue
Block a user