Skip to content

UnhandledErrorOrRejection when trying to connect to unreachable proxy #98

@xTRiM

Description

@xTRiM

When proxy designated in upstreamProxyUrl is unreachable for whatever reason - process dies instead of throwing error.

How to reproduce:

const SecretAgent = require('secret-agent');

(async () => {
    try {
        const agent = await new SecretAgent({
            showReplay: false,
            upstreamProxyUrl: 'http://127.0.0.1:65535'
        });
        await agent.goto('http://api.ipify.org/');
    }
    catch(err) {
        console.error(`Error: ${err}`)
    }
})();

Expected Behavior

Catchable error?

Current Behavior

Getting a couple of errors in the console log.

ts-node ./src/_playground.ts

2020-12-04T10:53:48.829Z ERROR [@secret-agent/core/index] UnhandledErrorOrRejection {
  clientError: '2020/12/04 13:53:48 Dial (proxy/remote) Error: dial tcp 127.0.0.1:65535: connect: connection refused',
  context: {}
}
2020-12-04T10:53:48.831Z ERROR [@secret-agent/core/index] UnhandledErrorOrRejection {
  clientError: "TypeError: Cannot create property 'stack' on string '2020/12/04 13:53:48 Dial (proxy/remote) Error: dial tcp 127.0.0.1:65535: connect: connection refused'",
  context: {}
}

Context

SecretAgent version: 1.2.0-alpha.2
ts-node: v9.1.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions