Skip to content

Make troubleshooting/debugging custom accessTokenCallbackClass possible - #2990

Merged
divang merged 2 commits into
mainfrom
users/divang/fix-custom-auth-exception
Jul 27, 2026
Merged

Make troubleshooting/debugging custom accessTokenCallbackClass possible#2990
divang merged 2 commits into
mainfrom
users/divang/fix-custom-auth-exception

Conversation

@divang

@divang divang commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary:
This change improves error visibility for custom accessTokenCallbackClass failures by preserving the original exception instead of only its cause.

What changed:
In [SQLServerConnection.java, the thrown SQLServerException now uses e instead of e.getCause().
If callback exception has no cause, the real exception is no longer lost.
If callback exception has a cause, full chained details are still available through the original exception.

Scope:
One file changed.
No functional auth flow change, only better troubleshooting/debugging context.

…, the relevant exception may be missed because of a call to getCause(). If the exception doesn't have a cause exception, it will leave no chained exception to the SQLServerException(), effectively eliminating effective troubleshooting information. If it does have a cause exception, it should still be listed as the logging prints out the stack trace will all the caused by traces.

(cherry picked from commit b01455f)
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.18%. Comparing base (613e728) to head (99efe2e).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2990      +/-   ##
============================================
+ Coverage     59.25%   60.18%   +0.93%     
- Complexity     5046     5140      +94     
============================================
  Files           153      153              
  Lines         36350    36636     +286     
  Branches       6650     6721      +71     
============================================
+ Hits          21538    22051     +513     
+ Misses        11053    10753     -300     
- Partials       3759     3832      +73     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@divang divang changed the title "Make troubleshooting/debugging custom accessTokenCallbackClass possible Make troubleshooting/debugging custom accessTokenCallbackClass possible Jul 20, 2026
@divang divang added this to the 13.5.1 milestone Jul 20, 2026
@divang divang self-assigned this Jul 20, 2026
@divang divang added the Enhancement An enhancement to the driver. Lower priority than bugs. label Jul 27, 2026
@divang
divang merged commit da79fd3 into main Jul 27, 2026
22 of 23 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Closed/Merged PRs in MSSQL JDBC Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement An enhancement to the driver. Lower priority than bugs.

Projects

Status: Closed/Merged PRs

Development

Successfully merging this pull request may close these issues.

5 participants