Skip to content

Commit

Permalink
Add message to assert, and add it to the ProcessGraphInvalidException.
Browse files Browse the repository at this point in the history
  • Loading branch information
EmileSonneveld committed Jun 10, 2024
1 parent 2157e8e commit 6749cde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openeo_driver/ProcessGraphDeserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,12 +1871,13 @@ def evaluate_process_from_url(process_id: str, namespace: str, args: dict, env:

try:
spec = res.json()
assert spec["id"].lower() == process_id.lower()
msg = f"{process_id=} does not match result from namespace query: '" + spec["id"] + "'"
assert spec["id"].lower() == process_id.lower(), msg
process_graph = spec["process_graph"]
parameters = spec.get("parameters", [])
except Exception as e:
_log.error(f"Failed to load process {process_id!r} from {candidate!r}", exc_info=True)
raise ProcessGraphInvalidException() from e
raise ProcessGraphInvalidException(str(e)) from e

return _evaluate_process_graph_process(
process_id=process_id, process_graph=process_graph, parameters=parameters, args=args, env=env
Expand Down
6 changes: 6 additions & 0 deletions openeo_driver/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@ class ProcessGraphInvalidException(OpenEOApiException):
_description = "The process doesn't contain a valid process graph, which means it doesn't comply to the general structure / schema."
_tags = ['Batch Jobs', 'Data Processing', 'Secondary Services', 'User-Defined Processes']

def __init__(self, message: str = ""):
if message == "":
super().__init__(message=self.message)
else:
super().__init__(message=self.message + " " + message)


class NoDataForUpdateException(OpenEOApiException):
status_code = 400
Expand Down

0 comments on commit 6749cde

Please sign in to comment.