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

Print the exception name along with the message for custom ODB errors #146

Closed
wants to merge 1 commit into from

Conversation

wllgrnt
Copy link
Contributor

@wllgrnt wllgrnt commented Jul 6, 2023

Motivation and Context

When raising and logging errors with ODB, when we hit a custom exception the error message is often difficult to understand. E.g calling str() on a RevisionConflictException gives:

 ((objId=500000005, fieldId=117, isIndexValue=False), (schema="testlooper_engine", typename="CommitTestDefinitionGenerationTask", fieldname="_status_history"))

When used with a general error logger it's impossible to know what the above error message is indicating. This PR modifies __str__ to include the exception name itself, which helps the user understand the nature of the issue.

Also adds a MultipleViewError to throw instead of a base Exception when applicable.

How Has This Been Tested?

pytest

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@wllgrnt wllgrnt force-pushed the will-more-detailed-view-errors branch from 0ba9037 to 1d656d5 Compare July 6, 2023 18:50
@atzannes
Copy link
Contributor

atzannes commented Oct 6, 2023

For better or worse, that's normal python behavior, so let's keep it that way

@atzannes atzannes closed this Oct 6, 2023
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.

2 participants