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

feat(cli): suppress stacktrace printing on configuration errors #4718

Conversation

shirshanka
Copy link
Contributor

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@shirshanka shirshanka requested a review from hsheth2 April 21, 2022 17:34
Copy link
Collaborator

@hsheth2 hsheth2 left a comment

Choose a reason for hiding this comment

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

Code looks good - seems like there’s a minor formatting issue

@github-actions
Copy link

github-actions bot commented Apr 21, 2022

Unit Test Results (build & test)

  97 files  ±0    97 suites  ±0   21m 53s ⏱️ - 7m 6s
701 tests ±0  642 ✔️ ±0  59 💤 ±0  0 ±0 

Results for commit 77abffa. ± Comparison against base commit 788fb8f.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Apr 21, 2022

Unit Test Results (metadata ingestion)

       5 files         5 suites   59m 7s ⏱️
   434 tests    434 ✔️   0 💤 0
2 095 runs  2 049 ✔️ 46 💤 0

Results for commit 77abffa.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@anshbansal anshbansal left a comment

Choose a reason for hiding this comment

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

Suppressing ValueError directly might cause issues with not having stacktraces. We are throwingValueError in pydantic validators as well as in other places outside pydantic validators.

Suggestion

  • change all places inside pydantic validators to raise ConfigurationError instead of ValueError
  • Do not suppress ValueError

@hsheth2
Copy link
Collaborator

hsheth2 commented Apr 22, 2022

@anshbansal I agree that we should remove ValueError from the suppressed list, but for a different reason.

pydantic validatiors must throw ValueError, TypeError, or AssertionError (see docs https://pydantic-docs.helpmanual.io/usage/validators/). However, pydantic itself will throw pydantic.ValidationError and so that's the error that we actually want to suppress.

Longer term, we need to switch all of our validators to throw ValueError instead of ConfigurationError, and then remove ConfigurationError from the suppressed list as well.

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.

3 participants