Incorrect constructor parameter types for class `PostgresError`
Open
Beginner friendly
Nobody has claimed this yet.
help wanted
Typescript
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
According to the types, to construct a new PostgresError the first argument is a message string:
With this code:
import postgres from "postgres";
const error = new postgres.PostgresError("Error message.");
console.log(Object.entries(error));
What actually logs is:
[
[ '0', 'E' ],
[ '1', 'r' ],
[ '2', 'r' ],
[ '3', 'o' ],
[ '4', 'r' ],
[ '5', ' ' ],
[ '6', 'm' ],
[ '7', 'e' ],
[ '8', 's' ],
[ '9', 's' ],
[ '10', 'a' ],
[ '11', 'g' ],
[ '12', 'e' ],
[ '13', '.' ],
[ 'name', 'PostgresError' ]
]
That's because actually the first argument it seems is supposed to be an Error instance:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/errors.js at the constructor referenced in the issue, then compare its accepted argument with the published constructor types. Confirm the mismatch using the example from the report and make the runtime behavior and declared parameter types agree; existing checks should pass afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100