Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b2bedc

Browse files
feat(pg-connection-string): throw correct error when URL parsing fails
Fixes #3513
1 parent 27a2754 commit 1b2bedc

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

‎packages/pg-connection-string/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function parse(str, options = {}) {
3535
} catch (err) {
3636
// Remove the input from the error message to avoid leaking sensitive information
3737
err.input && (err.input = '*****REDACTED*****')
38+
throw err
3839
}
3940

4041
// We'd like to use Object.fromEntries() here but Node.js 10 does not support it

‎packages/pg-connection-string/test/parse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ describe('parse', function () {
330330
parse(connectionString)
331331
} catch (err: unknown) {
332332
expect(JSON.stringify(err)).to.not.include(password, 'Password should not be in the error message')
333+
expect(JSON.stringify(err)).to.include('REDACTED', 'The thrown error should contain the redacted URL')
333334
return
334335
}
335336
throw new Error('Expected an error to be thrown')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /