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

fix: Better optional deps handling #353

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

abmusse
Copy link
Member

@abmusse abmusse commented Oct 26, 2022

odbc and idb-connector are optional deps and might not be installed.
When either is not available, return an error back to user instead of failing.

Fixes #317

The odbc and idb are optional deps that might not be installed.
When either is not available, return an error back to user
instead of failing.
@abmusse abmusse force-pushed the better-optional-deps-error-messages branch from 2b3b4a0 to 53f9bf1 Compare October 26, 2022 22:32
@abmusse abmusse added this to the Version 1.1 milestone Oct 27, 2022
@@ -28,6 +28,11 @@ try {
}

function idbCall(config, xmlInput, cb) {
// idb transport is not available bail out
if (idb === null) {
cb(new Error('idb-connector module was not found, the idb transport is only usable on IBM i.'), null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe something like

"idb-connector was not found, ensure idb-connector is installed properly (idb-connector is only available on IBM i)"

I get nervous about the term "module", since idb-connector doesn't have type: module in its package.json, which affects all sorts of things (CJS vs. ESM modules)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good to me!

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed up in: 12083c9

lib/transports/odbcTransport.js Show resolved Hide resolved
Copy link
Collaborator

@markdirish markdirish left a comment

Choose a reason for hiding this comment

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

LGTM

@abmusse abmusse merged commit f896ef9 into master Oct 27, 2022
@abmusse abmusse deleted the better-optional-deps-error-messages branch October 27, 2022 19:17
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.

Return a better error when optional deps are not found
2 participants