FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Throw errors, not strings by and3k5 · Pull Request #514 · sql-js/sql.js · GitHub

/ sql.js Public

Throw errors, not strings - #514

Open
and3k5 wants to merge 2 commits into
sql-js:masterfrom
and3k5:throw-errors
Open

Throw errors, not strings#514
and3k5 wants to merge 2 commits into
sql-js:masterfrom
and3k5:throw-errors

Conversation

and3k5 commented Jun 1, 2022

Copy link
Copy Markdown

Throwing strings makes it difficult to debug for specific issues when working on projects that use sql.js.
Replaced string with Errors when being thrown. (Really just using a constructor around the string).

lovasoa commented Jun 1, 2022

Copy link
Copy Markdown
Member

This would be a good thing in theory, but it would require a major version bump. Maybe we can include that when we need to break backwards compatibility anyway

and3k5 commented Jun 2, 2022

Copy link
Copy Markdown
Author

Makes sense.

Would it be possible to make a prerelease of some sort which includes this? Or is it too far in time?

and3k5 commented Jun 7, 2022

Copy link
Copy Markdown
Author

Another suggestion:
Can me make a change where we make a global switch to change how errors are thrown?

Something like

const initSqlJs = require('sql.js');
initSqlJs.throwAsErrors = true;

Copy link
Copy Markdown

Definitely a good way to incorporate the behaviour keeping it optional and eventually making it the default whenever a major bump is planned.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL