Skip to content

Commit

Permalink
Fix error message on access to restricted zenodo records
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 17, 2024
1 parent d638bf4 commit 7c60446
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/galaxy/files/sources/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
TypedDict,
)

from galaxy.exceptions import AuthenticationRequired
from galaxy.files.sources import (
Entry,
EntryData,
Expand Down Expand Up @@ -406,6 +407,10 @@ def _get_request_headers(self, user_context: OptionalUserContext):
return headers

def _ensure_response_has_expected_status_code(self, response, expected_status_code: int):
if response.status_code == 403:
raise AuthenticationRequired(
f"Please make sure you have the necessary permissions to access the requested resource."
)
if response.status_code != expected_status_code:
error_message = self._get_response_error_message(response)
raise Exception(
Expand Down

0 comments on commit 7c60446

Please sign in to comment.