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

Enhance Spectacles exceptions #196

Merged
merged 5 commits into from
May 11, 2020
Merged

Conversation

joshtemple
Copy link
Collaborator

This PR changes the attributes of SpectaclesException and its children.

Going forward, all SpectaclesException instances should have, at minimum, the following attributes:

  • name: A lowercase, hyphenated, unique semantic ID for the error (e.g. unable-to-authenticate)
  • title: A short, human-readable error message with a period and capitalized first letter
  • detail: A human-readable message providing additional details and preferably offering suggestions for debugging or fixing the issue

Subclasses of SpectaclesException may define other attributes as needed. For example, LookerApiError accepts the requests response and parses out some useful data like the URL, method, and any data returned by the Looker API as JSON.

The remainder of the PR is refactoring existing error messages to match this new format.

@joshtemple joshtemple requested a review from DylanBaker May 10, 2020 00:06
@codecov
Copy link

codecov bot commented May 10, 2020

Codecov Report

Merging #196 into master will increase coverage by 0.60%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
+ Coverage   83.49%   84.09%   +0.60%     
==========================================
  Files          10       10              
  Lines         921      937      +16     
==========================================
+ Hits          769      788      +19     
+ Misses        152      149       -3     
Impacted Files Coverage Δ
spectacles/cli.py 71.83% <ø> (ø)
spectacles/utils.py 85.36% <75.00%> (-0.69%) ⬇️
spectacles/client.py 91.52% <85.71%> (+1.58%) ⬆️
spectacles/validators.py 98.36% <87.50%> (+<0.01%) ⬆️
spectacles/exceptions.py 93.33% <100.00%> (+4.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42984c4...f03bdfb. Read the comment docs.

@joshtemple joshtemple merged commit 8ca319e into master May 11, 2020
@joshtemple joshtemple deleted the feature/enhanced-exceptions branch September 1, 2021 18:51
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