This is an automated email from the ASF dual-hosted git repository.

rkk pushed a commit to branch SDAP-525
in repository https://gitbox.apache.org/repos/asf/sdap-nexus.git

commit 00cee5d69a6176d33f2f0a52520a8aa4c02ce20d
Author: rileykk <[email protected]>
AuthorDate: Mon Aug 19 08:17:51 2024 -0700

    Error handling on ds listing for zarr
---
 CHANGELOG.md                                    |  9 +++++++++
 data-access/nexustiles/backends/zarr/backend.py | 21 +++++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca865a9..c244d82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this 
file.
 The format is based on [Keep a 
Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [Unreleased] - Unreleased
+### Added
+### Changed
+### Deprecated
+### Removed
+### Fixed
+- SDAP-525: Fixed expired AWS creds for Zarr datasets breaking list endpoint
+### Security
+
 ## [1.3.0] - 2024-06-10
 ### Added
 - SDAP-506:
diff --git a/data-access/nexustiles/backends/zarr/backend.py 
b/data-access/nexustiles/backends/zarr/backend.py
index 2cf91e5..b055b08 100644
--- a/data-access/nexustiles/backends/zarr/backend.py
+++ b/data-access/nexustiles/backends/zarr/backend.py
@@ -123,14 +123,19 @@ class ZarrBackend(AbstractTileService):
         }
 
         if not simple:
-            min_date = self.get_min_time([])
-            max_date = self.get_max_time([])
-            ds['start'] = min_date
-            ds['end'] = max_date
-            ds['iso_start'] = 
datetime.utcfromtimestamp(min_date).strftime(ISO_8601)
-            ds['iso_end'] = 
datetime.utcfromtimestamp(max_date).strftime(ISO_8601)
-
-            ds['metadata'] = dict(self.__ds.attrs)
+            try:
+                min_date = self.get_min_time([])
+                max_date = self.get_max_time([])
+                ds['start'] = min_date
+                ds['end'] = max_date
+                ds['iso_start'] = 
datetime.utcfromtimestamp(min_date).strftime(ISO_8601)
+                ds['iso_end'] = 
datetime.utcfromtimestamp(max_date).strftime(ISO_8601)
+
+                ds['metadata'] = dict(self.__ds.attrs)
+            except Exception as e:
+                logger.error(f'Failed to access dataset for {self._name}. 
Cause: {e}')
+                ds['error'] = "Dataset is currently unavailable"
+                ds['error_reason'] = str(e)
 
         return [ds]
 

Reply via email to