Skip to content

Commit 14a183e

Browse files
committed
Improve curl error logging
Errors from the `curl` command can often come from an infinite loop of redirections. The error message now contains indication on how to test if the error comes from an inifinite loop.
1 parent d78ab82 commit 14a183e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ async function getFinalRedirect(url, method = 'GET') {
3030
const cmd = `curl -o /dev/null -sL -k -w "%{url_effective}" -X ${method} -I "${url}"`;
3131
exec(cmd, (error, out) => {
3232
if (error) {
33+
console.log(chalk.red('An error occured while doing a request. This might be caused by an infinite redirection loop.'));
34+
console.log(chalk.red('Try running the following command to confirm this:\n'));
35+
console.log(chalk.red(`\tcurl -sIL -X ${method} "${url}"\n`));
3336
console.log(chalk.red(error.message));
3437
process.exit(1);
3538
}

0 commit comments

Comments
 (0)