sql.js icon indicating copy to clipboard operation
sql.js copied to clipboard

Throw errors, not strings

Open and3k5 opened this issue 3 years ago • 4 comments

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).

and3k5 avatar Jun 01 '22 19:06 and3k5

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

lovasoa avatar Jun 01 '22 23:06 lovasoa

Makes sense.

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

and3k5 avatar Jun 02 '22 06:06 and3k5

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;

and3k5 avatar Jun 07 '22 18:06 and3k5