Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/datasource-sql/src/connection/handle-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function handleProxyErrors(
): void {
// eslint-disable-next-line max-len
// @link: list of errors thrown by the proxy https://github.com/JoshGlazebrook/socks/blob/76d013e4c9a2d956f07868477d8f12ec0b96edfc/src/common/constants.ts#LL10C10-L10C10
if (error?.stack.includes('SocksClient')) {
if (error?.stack?.includes('SocksClient')) {
if (
error.message.includes('Socket closed') ||
error.message.includes('Socks5 proxy rejected connection')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ describe('handleErrors', () => {
});
});

describe('when the error has an empty stack trace', () => {
it('should throw an error', () => {
const error = new Error('An error');
error.stack = null;
expect(() => handleErrors(error, null, null)).toThrow(error);
});
});

describe('when the error is thrown by the proxy', () => {
describe('when the proxy has an error with database uri', () => {
it('should throw an error', () => {
Expand Down