Skip to content

fix describeTable reject with non-error - #10513

Closed
ktret wants to merge 1 commit into
sequelize:masterfrom
ktret:patch-3
Closed

ktret wants to merge 1 commit into
sequelize:masterfrom
ktret:patch-3

Conversation

@ktret

@ktret ktret commented Mar 6, 2019

Copy link
Copy Markdown

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.

@SimonSchick SimonSchick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread lib/query-interface.js
// 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
Copy Markdown
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
Copy Markdown
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