Skip to content

Commit

Permalink
Pass up preflight errors, fix error test
Browse files Browse the repository at this point in the history
The order that the preflight errors are in is nondeterministic for dependencies of the same level in the tree
  • Loading branch information
greenape committed Oct 23, 2024
1 parent 1d77308 commit 52c0bdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions flowmachine/flowmachine/core/server/action_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def _load_query_object(params: dict) -> "BaseExposedQuery":
f"The original error was: '{orig_error_msg}'"
)
raise QueryLoadError(
error_msg,
params,
orig_error_msg=orig_error_msg,
error_msg, params, orig_error_msg=orig_error_msg, errors=exc.errors
)
except TypeError as exc:
# We need to catch TypeError here, otherwise they propagate up to
Expand All @@ -110,11 +108,6 @@ def _load_query_object(params: dict) -> "BaseExposedQuery":
params,
orig_error_msg=orig_error_msg,
)
raise QueryLoadError(
error_msg,
params,
orig_error_msg=orig_error_msg,
)
except ValidationError as exc:
# The dictionary of marshmallow errors can contain integers as keys,
# which will raise an error when converting to JSON (where the keys
Expand Down
4 changes: 3 additions & 1 deletion flowmachine/tests/server/test_action_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ async def test_run_query_error_handled(dummy_redis, server_config):
),
)
assert msg.status == ZMQReplyStatus.ERROR
assert msg.msg.rstrip() == "Preflight failed for 7b71413efc91213e798ca3bd53107186."
assert msg.msg.rstrip().startswith(
"Internal flowmachine server error: could not create query object using query schema. The original error was: 'Pre-flight failed for '7b71413efc91213e798ca3bd53107186'. Errors:"
)
assert len(msg.payload["errors"]) == 3


Expand Down

0 comments on commit 52c0bdc

Please sign in to comment.