$ yarn test:run
console.log
PostgrestError: relation "public.does_not_exist" does not exist
at /Users/meyer9/development/postgrest-js/src/PostgrestBuilder.ts:160:17
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Object.<anonymous> (/Users/meyer9/development/postgrest-js/test/basic.ts:10:17) {
code: '42P01',
details: null,
hint: null
}
at Object.<anonymous> (test/basic.ts:12:13)
PASS test/index.test.ts
✓ returned error should include stack (46 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.587 s, estimated 1 s
Ran all test suites.
What kind of change does this PR introduce?
Feature: thrown errors now return a stack trace:
What is the current behavior?
Errors are currently plain objects: https://github.com/supabase/postgrest-js/issues/501
What is the new behavior?
Thrown errors will now throw a PostgrestError with a message and the details. Errors should serialize to the same value by default.