Skip to content

Conversation

@nick-w-nick
Copy link
Contributor

This PR is to fix #1669, where the library throws an unhandled exception if it encounters an ENVCHANGE event of type DATABASE_MIRRORING_PARTNER.

This behavior isn't explicitly documented, but there have been a few issues brought up regarding this functionality in the past, and it has been stated that tedious does not plan to support failover partners. While that may be the case, this event being emitted by SQL Server is causing Tedious to crash completely rather than simply ignoring it as you would expect.

The changes in this PR are to create the databaseMirroringPartner event emitter and register the necessary handler methods in the associated token handler classes, to prevent the default behavior of throwing an Unexpected token error.

To clarify, this does not implement mirroring functionality or anything of the sort, it simply updates the default behavior to allow the event to pass through and be ignored, rather than unnecessarily throwing an unhandled exception.

@codecov
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.80%. Comparing base (fc288ed) to head (7579731).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/token/handler.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1671      +/-   ##
==========================================
- Coverage   78.82%   78.80%   -0.02%     
==========================================
  Files          90       90              
  Lines        4887     4888       +1     
  Branches      920      920              
==========================================
  Hits         3852     3852              
- Misses        736      737       +1     
  Partials      299      299              

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nick-w-nick
Copy link
Contributor Author

@arthurschreiber Just curious if this can be merged anytime soon?

I am still using a custom fork of this package to support my MSSQL connections, and would greatly appreciate being able to switch back to the official version once this is merged in.

Let me know if you need any changes to the PR in order to proceed.

Thanks!

@nick-w-nick
Copy link
Contributor Author

@arthurschreiber Is it possible to get this PR merged sometime in the near future?

We have been maintaining a fork of tedious while waiting on this PR to be merged, and would appreciate being able to swap back to the official version.

@nick-w-nick
Copy link
Contributor Author

@arthurschreiber Checking in again as to if this can be merged anytime soon, I am still required to use a custom fork of tedious for my MSSQL projects due to this fix not yet being merged into master.

Let me know if I can provide any assistance.

Thanks!

@arthurschreiber arthurschreiber merged commit cfb211a into tediousjs:master Dec 22, 2025
26 of 29 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 19.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error connecting to MSSQL database with clustering enabled

2 participants