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

ValueProvider errors to have helpful error messages #321

Merged
merged 13 commits into from
Jun 26, 2024

Conversation

yasonk
Copy link
Contributor

@yasonk yasonk commented Jun 26, 2024

Currently errors in value provider of a pipeline do not contain sufficient information. Need to show value provider expression and document in the error log message.

Introducing __str__ method allows for a more readable string representation of ValueProviders
Try and except blocks are added in single_value and many_values methods
updated tests

@@ -24,6 +24,9 @@ def many_values(self, _: ProviderContext) -> Iterable[Any]:
def is_static(self) -> bool:
return True

def __str__(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

StaticProvider does not have any posibility of errors in single or many_values methods

@@ -30,6 +30,9 @@ def many_values(self, context: ProviderContext) -> Iterable[Any]:
return []
return value if isinstance(value, list) else [value]

def __str__(self):
Copy link
Contributor Author

@yasonk yasonk Jun 26, 2024

Choose a reason for hiding this comment

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

VariableValueProvider does not have any errors that would benefit from anything other than the stack trace, which we already print

@yasonk yasonk linked an issue Jun 26, 2024 that may be closed by this pull request
@Cole-Greer
Copy link
Contributor

It's always nice to see additional context in the errors. Looks good to me!

zprobst
zprobst previously approved these changes Jun 26, 2024
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 96.10390% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.75%. Comparing base (3ffc662) to head (61034c2).

Files Patch % Lines
...pipeline/value_providers/mapping_value_provider.py 92.85% 1 Missing ⚠️
...ne/value_providers/string_format_value_provider.py 91.66% 1 Missing ⚠️
...ipeline/value_providers/variable_value_provider.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #321   +/-   ##
=======================================
  Coverage   97.74%   97.75%           
=======================================
  Files         142      142           
  Lines        4754     4802   +48     
=======================================
+ Hits         4647     4694   +47     
- Misses        107      108    +1     
Flag Coverage Δ
3.10-macos-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.10-ubuntu-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.10-windows-latest 97.70% <96.10%> (+<0.01%) ⬆️
3.11-macos-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.11-ubuntu-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.11-windows-latest 97.70% <96.10%> (+<0.01%) ⬆️
3.12-macos-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.12-ubuntu-latest 97.75% <96.10%> (+<0.01%) ⬆️
3.12-windows-latest 97.70% <96.10%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yasonk yasonk merged commit 2d2a3e5 into main Jun 26, 2024
10 of 11 checks passed
@yasonk yasonk deleted the feat/value-providers-helpful-errors branch June 26, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQUEST] RegexValueProvider to produce some debug messages
3 participants