mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 13:08:11 +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:
co-authored by
Copilot
Timmy Huang
parent
0fddcd042a
commit
2b86f8e600
@@ -173,13 +173,24 @@ class AnndataAdaptor(DataAdaptor):
|
|||||||
)
|
)
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
raise DatasetAccessError("Out of memory - file is too large for available memory.")
|
raise DatasetAccessError("Out of memory - file is too large for available memory.")
|
||||||
except Exception:
|
except Exception as e:
|
||||||
import traceback
|
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:
|
if self.server_config.app__verbose:
|
||||||
message += f"\n{traceback.format_exc()}"
|
message += f"\n{traceback.format_exc()}"
|
||||||
raise DatasetAccessError(message)
|
raise DatasetAccessError(message)
|
||||||
|
|||||||
Reference in New Issue
Block a user