Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent obscuring errors when querying pg_catalog #204

Merged
merged 2 commits into from
Jul 30, 2021

Conversation

JAForbes
Copy link
Contributor

What

Ensures if there is any postgres errors when invoking fetchArrayTypes that the original error is not obscured.
I don't have a solid understanding of the internals, so I simply added the missing property. There may be a better way.

How to test

  • revoke all on all tables in schema pg_catalog from public;
  • Run a simple query in postgres.js, e.g. select 1
  • You should get a postgres permissions error

Original Error

Uncaught Exception: TypeError: Cannot read property 'replace' of undefined

Expected Error

PostgresError: permission denied for table pg_type

Fixes #202

@porsager
Copy link
Owner

Oh cool. Very nice!

The fix looks good, but origin should be created as new Error().stack

@JAForbes
Copy link
Contributor Author

Ah great! I'll push a fix.

@porsager
Copy link
Owner

Looks good. Would you mind updating to work with #204 merged?

@JAForbes
Copy link
Contributor Author

Is that right?

@porsager porsager merged commit e3ace38 into porsager:master Jul 30, 2021
@porsager
Copy link
Owner

It's great - thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

origin property missing on query in fetchArrayTypes query
2 participants