Skip to content

Commit

Permalink
Merge pull request #304 from jwalton/fix-bad-passwords
Browse files Browse the repository at this point in the history
fix: Fail immediately for a bad password on latest amqplib.
  • Loading branch information
jwalton committed Oct 24, 2022
2 parents 402914f + 412ed92 commit 0d5dbeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -34,7 +34,7 @@
"@types/whatwg-url": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"amqplib": "^0.8.0",
"amqplib": "^0.10.3",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-jest": "^1.0.2",
Expand Down
6 changes: 3 additions & 3 deletions src/AmqpConnectionManager.ts
Expand Up @@ -220,9 +220,9 @@ export default class AmqpConnectionManager extends EventEmitter implements IAmqp
this._connect();

let reject: (reason?: any) => void;
const onConnectFailed = ({ err }: { err: any }) => {
// Ignore disconnects caused by dead servers etc., but throw on operational errors like bad credentials.
if (err.isOperational) {
const onConnectFailed = ({ err }: { err: Error }) => {
// Ignore disconnects caused bad credentials.
if (err.message.includes('ACCESS-REFUSED') || err.message.includes('403')) {
reject(err);
}
};
Expand Down

0 comments on commit 0d5dbeb

Please sign in to comment.