planetscale / planetscale/database-js

Missing/more errors

Open
#82 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
42
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the INSERT behavior through conn.execute and read the discussion in pull request #62, which the issue references. Compare the requested returned-error behavior with the existing throwing behavior and define a consistent result or configuration contract; done means duplicate-record errors are observable and covered by the project's tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.