Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail correctly if lookup_type throws a KeyError in BaseResult.__new__ #15596

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

zzstoatzz
Copy link
Collaborator

related to #15585

@@ -1155,7 +1155,7 @@ def __new__(cls: Type[Self], **kwargs) -> Self:
try:
subcls = lookup_type(cls, dispatch_key=kwargs["type"])
except KeyError as exc:
raise ValidationError(errors=[exc], model=cls)
Copy link
Collaborator Author

@zzstoatzz zzstoatzz Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just invalid use of ValidationError (which cannot be constructed directly like this), leading to this error on the issue

  File "/opt/homebrew/anaconda3/envs/env/lib/python3.12/site-packages/prefect/results.py", line 1158, in __new__
    raise ValidationError(errors=[exc], model=cls)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: No constructor defined

@zzstoatzz zzstoatzz added the fix A fix for a bug in an existing feature label Oct 7, 2024
@zzstoatzz zzstoatzz self-assigned this Oct 7, 2024
Copy link

codspeed-hq bot commented Oct 7, 2024

CodSpeed Performance Report

Merging #15596 will not alter performance

Comparing fix-lookup-type-failure (7379211) with main (f8bcb64)

Summary

✅ 3 untouched benchmarks

@zzstoatzz zzstoatzz marked this pull request as ready for review October 7, 2024 16:23
@zzstoatzz zzstoatzz merged commit 6590d85 into main Oct 7, 2024
36 checks passed
@zzstoatzz zzstoatzz deleted the fix-lookup-type-failure branch October 7, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug in an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants