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

TSQL: TRY/CATCH #2044

Merged
merged 5 commits into from Dec 6, 2021
Merged

TSQL: TRY/CATCH #2044

merged 5 commits into from Dec 6, 2021

Conversation

jpers36
Copy link
Contributor

@jpers36 jpers36 commented Dec 5, 2021

Fixes #1541

Adding TRY/CATCH logic to TSQL. This block pair allows for exceptions to be caught and handled within TSQL. Added a test case as well.

As part of this change, I tweaked the way that BeginEndSegment is used. BeginEndSegment was always referenced as an alternative to StatementSegment and vice versa, so I collapsed BeginEndSegment into StatementSegment. This was to simplify TRY/CATCH's implementation, which is very similar to BeginEndSegment. This caused trivial changes to a few BEGIN/END test cases.

@codecov
Copy link

codecov bot commented Dec 5, 2021

Codecov Report

Merging #2044 (031aa9b) into main (42b142e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #2044   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          148       148           
  Lines        10495     10499    +4     
=========================================
+ Hits         10495     10499    +4     
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_tsql_keywords.py 100.00% <ø> (ø)
src/sqlfluff/dialects/dialect_tsql.py 100.00% <100.00%> (ø)

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 42b142e...031aa9b. Read the comment docs.

Copy link
Contributor

@jpy-git jpy-git left a comment

Choose a reason for hiding this comment

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

@jpers36 just a couple questions to check, but otherwise looking good 😄

src/sqlfluff/dialects/dialect_tsql.py Show resolved Hide resolved
src/sqlfluff/dialects/dialect_tsql.py Show resolved Hide resolved
src/sqlfluff/dialects/dialect_tsql.py Show resolved Hide resolved
src/sqlfluff/dialects/dialect_tsql.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jpy-git jpy-git left a comment

Choose a reason for hiding this comment

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

Thanks for adding adding this @jpers36, looks great! LGTM 🚀

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.

Try-Catch in TSQL
2 participants