Skip to content

Commit

Permalink
Merge pull request #76 from SEKOIA-IO/feat/improve_data_path_error_me…
Browse files Browse the repository at this point in the history
…ssage

feat: Improve message when data storage is not reachable
  • Loading branch information
Darkheir authored Sep 26, 2023
2 parents e156c6c + 549d4c1 commit 1616964
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Improve error message when it is not possible to access the data storage

## [1.5.0] - 2023-09-19

### Added
Expand Down
9 changes: 8 additions & 1 deletion sekoia_automation/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import requests
import sentry_sdk
from botocore.exceptions import ClientError
from pydantic import BaseModel
from requests import HTTPError, Response

Expand Down Expand Up @@ -350,8 +351,14 @@ def _ensure_data_path_set(self):
try:
self._data_path = get_data_path()
except Exception as e:
if (
isinstance(e, ClientError)
and e.response.get("Error", {}).get("Code") == "403"
):
self.log("Access denied to the object storage", level="critical")
raise
self.log_exception(e)
self.log("Impossible to get the data path", level="critical")
self.log("Impossible access the object storage", level="critical")
raise

def log(
Expand Down

0 comments on commit 1616964

Please sign in to comment.