Skip to content

Commit

Permalink
chore: removed unneeded modules
Browse files Browse the repository at this point in the history
  • Loading branch information
katsanva committed Jan 30, 2024
1 parent a26165a commit 6578727
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -95,8 +95,6 @@
"request": "^2.88.2",
"sinon": "^17.0.1",
"slow-stream": "0.0.4",
"socks": "^2.7.1",
"socks-proxy-agent": "^8.0.2",
"tempy": "^3.1.0",
"then-busboy": "^5.2.1",
"tough-cookie": "^4.1.3",
Expand Down
10 changes: 8 additions & 2 deletions test/error.ts
Expand Up @@ -4,11 +4,10 @@ import net from 'node:net';
import http from 'node:http';
import stream from 'node:stream';
import {pipeline as streamPipeline} from 'node:stream/promises';
import {Agent} from 'node:https';
import test from 'ava';
import getStream from 'get-stream';
import is from '@sindresorhus/is';
import {SocksProxyAgent} from 'socks-proxy-agent';
import {SocksClientError} from 'socks';
import got, {RequestError, HTTPError, TimeoutError} from '../source/index.js';
import type Request from '../source/core/index.js';
import withServer from './helpers/with-server.js';
Expand Down Expand Up @@ -369,10 +368,17 @@ test('should wrap got cause', async t => {
});

test('should wrap non-got cause', async t => {
class SocksProxyAgent extends Agent {
createConnection() {
throw new SocksClientError('oh no');
}
}
class SocksClientError extends Error {}
const error = await t.throwsAsync<RequestError>(got('https://github.com', {retry: {limit: 0}, timeout: {read: 1}, agent: {https: new SocksProxyAgent('socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com')}}));
const cause = error?.cause as Error;
t.is(error?.code, 'ERR_GOT_REQUEST_ERROR');
t.is(error?.message, cause.message);
t.is(error?.message, 'oh no');
t.assert(cause instanceof SocksClientError);
});

Expand Down

0 comments on commit 6578727

Please sign in to comment.