database-js
database-js copied to clipboard
Missing/more errors
Thanks for this great library, it's fantastic to be able to query directly from Cloudflare Pages 🥳
Based on my experiments so far I feel like the library is pretty silent regarding errors, instead of returning or throwing anything it just does nothing, for example inserting a record with an existing id twice, only the first time shows the result of the query, second time nothing happens.
Personally I definitely prefer that it doesn't throw but it'd be really helpful if it could return errors, so I could react accordingly.
const result = await conn.execute(`INSERT INTO user (id, username) VALUES (?, ?)`, [id, username]);
console.log(JSON.stringify({ result }, null, 4));
Edit: just stumbled upon https://github.com/planetscale/database-js/pull/62 😅 though as stated I'd prefer the former returning errors instead of throwing, or the option to configure this, in my case it does nothing where I expect some form of information.