-
Notifications
You must be signed in to change notification settings - Fork 333
Check and access metaclass error_code property properly #3349
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
Conversation
88c9181 to
9ec18ea
Compare
Signed-off-by: Andres Gomez Ferrer <[email protected]>
9ec18ea to
b68d416
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3349 +/- ##
==========================================
- Coverage 47.70% 47.51% -0.19%
==========================================
Files 216 216
Lines 22686 22625 -61
Branches 2971 2973 +2
==========================================
- Hits 10822 10751 -71
- Misses 11286 11300 +14
+ Partials 578 574 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Andres Gomez Ferrer <[email protected]>
|
Hi @andresgomezfrr , from flytekit.exceptions.user import FlyteUserException, FlyteUserRuntimeException
class Example(FlyteUserException):
_ERROR_CODE = "USER:Example"
v = Example()
print(type(v).error_code) # USER:Example
print(hasattr(v, "error_code")) # False
print(hasattr(v.__class__, "error_code")) # TrueBased on your changes, I think you are trying to get the custom error code when doing the following? v = FlyteUserRuntimeException(Example())
print(v.error_code) # Expected: USER:ExampleThank you! |
Exactly the main reason is to get the proper error code. Currently if you check the master code: |
|
I also updated this logic https://github.com/flyteorg/flytekit/pull/3349/files#diff-4fe1bf14925335fc7bc5e5e01f51ccb5980680add97005d244b114d9e05f782dR34-R39 to allow all the cases, the |
machichima
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clarification! Could you please run make lint to solve the CI lint error?
6c4ead7
done! :) |
Signed-off-by: Andres Gomez Ferrer <[email protected]>
6c4ead7 to
74d89e0
Compare
Tracking issue
Closes flyteorg/flyte#6719
Why are the changes needed?
The changes are needed to validate and access the
error_codeproperty of the metaclass properly.Current:
Proposed:
How was this patch tested?
Above example
Summary by Bito