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

Convert unexpected parameter validation errors to InvalidParameterError #4084

Merged
merged 6 commits into from
Sep 4, 2023

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Aug 19, 2019

What type of PR is this? (check all applicable)

  • Refactor

Description

A quick follow up to #4072

@rauchy rauchy requested a review from arikfr August 19, 2019 20:53
Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Looks fine, but I wonder if we won't swallow some edge cases that we should handle differently this way? Maybe worth keeping existing error handling and expend it over time as we discover new cases?

This way we can add logging for exceptions in the case of really unexpected ones (and properly handle them if needed).

Wdyt?

package-lock.json Outdated Show resolved Hide resolved
@guidopetri
Copy link
Contributor

@rauchy , thanks for the PR! We've updated a lot of things now that we're Community-driven so - if you're still interested in getting this merged - would you mind rebasing off master to re-run the CI, as well as updating merge conflicts?

We're trying to clean up our PR todo list, so if you're not interested, that's fine - we'll close the PR in about a week if we don't hear back. If you're interested in reopening the PR afterwards, we would also very much welcome that.

@guidopetri guidopetri force-pushed the fail-validation-on-unexpected-errors branch from 6ae3438 to 82fe65c Compare August 25, 2023 00:51
@guidopetri guidopetri force-pushed the fail-validation-on-unexpected-errors branch from 96c6751 to 51805e9 Compare August 25, 2023 01:00
@guidopetri guidopetri enabled auto-merge (squash) August 25, 2023 01:03
@codecov
Copy link

codecov bot commented Aug 25, 2023

Codecov Report

Merging #4084 (490d9a6) into master (710dd8c) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4084      +/-   ##
==========================================
- Coverage   60.87%   60.86%   -0.02%     
==========================================
  Files         155      155              
  Lines       12718    12714       -4     
  Branches     1729     1730       +1     
==========================================
- Hits         7742     7738       -4     
  Misses       4747     4747              
  Partials      229      229              
Files Changed Coverage Δ
redash/models/parameterized_query.py 97.56% <100.00%> (-0.08%) ⬇️

@guidopetri guidopetri disabled auto-merge August 25, 2023 01:22
@justinclift
Copy link
Member

This one kind of looks like it could have more test coverage added, to get the Codecov pieces to pass?

@guidopetri
Copy link
Contributor

Yeah, it was passing before I rebased, heh

@guidopetri guidopetri enabled auto-merge (squash) September 4, 2023 20:42
@guidopetri
Copy link
Contributor

guidopetri commented Sep 4, 2023

Alright, that's the best I'm getting this PR. 😅 there was a coverage change because all error types were being converted to InvalidParameterError, when in reality there was a specific kind of error (QueryDetachedFromDataSourceError) that needed to be raised separately. (@arikfr had a lot of foresight back when he made his original comment, heh)

Fixing that, there's no indirect coverage changes, but the coverage is going down anyway because we are removing lines that were fully covered - i.e. the percentage of fully covered lines goes down because the absolute number of fully covered lines is going down.

@guidopetri guidopetri merged commit f1d5ac0 into master Sep 4, 2023
16 checks passed
@justinclift justinclift deleted the fail-validation-on-unexpected-errors branch September 4, 2023 23:43
@justinclift
Copy link
Member

Cool, good stuff @guidopetri. 😁

@guidopetri
Copy link
Contributor

It took me like two hours to figure out the fix lol. Lesson learned: don't use bare exceptions

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.

4 participants