Skip to content

Conversation

@ktret
Copy link

@ktret ktret commented Mar 6, 2019

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Avoid (node:120) Warning: a promise was rejected with a non-error: [object String] by rejecting with an error, like your other Promise.reject calls.

Avoid `(node:120) Warning: a promise was rejected with a non-error: [object String]` by rejecting with an error, like your other Promise.reject calls.
Copy link
Contributor

@SimonSchick SimonSchick left a comment

Choose a reason for hiding this comment

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

Yup, I don't think this needs a functional test.
But please ensure https://eslint.org/docs/rules/prefer-promise-reject-errors is enabled!

// it will not throw an error like built-ins do (e.g. DESCRIBE on MySql).
if (_.isEmpty(data)) {
return Promise.reject(`No description found for "${tableName}" table. Check the table name and schema; remember, they _are_ case sensitive.`);
return Promise.reject(new Error(`No description found for "${tableName}" table. Check the table name and schema; remember, they _are_ case sensitive.`));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: you can make this a throw since this is a promise context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, throw will be clean

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.

3 participants