`console.log(error)` doesn't show full Postgres error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Hey, not an issue since I solved it but think others might run into this.
I was trying to access the Postgres error for a foreign key constraint violation. I wasn't sure of the schema. So, I thought to print it but nothing worked:
console.log(
Object.keys(e),
Object.getOwnPropertyNames(e),
Object.getOwnPropertyDescriptors(e),
Reflect.ownKeys(e),
)
These all outputted: [ 'stack', 'query', 'parameters', 'args', 'types' ].
Ultimately looking at the type helped: https://github.com/porsager/postgres/blob/6f20a4820c683b33e7670b606d8daf5670f4b973/types/index.d.ts#L201
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 the linked types/index.d.ts location and inspect the declared error type and its properties. Compare that definition with the listed own keys to identify where the full PostgreSQL error details are exposed; the issue provides no requested code or documentation change to verify as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, postgresql
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100