Skip to content

Commit

Permalink
feat: throw on invalid hostname (#212)
Browse files Browse the repository at this point in the history
* fix inifinte loop with invalid hostname

* fix spacing

* add hostname to error message invalid hostname

---------

Co-authored-by: arnesetzer <[email protected]>
  • Loading branch information
arnesetzer and arnesetzer authored Aug 7, 2024
1 parent 9c580a9 commit 92101aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/request_urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function request_urls(config, urls, callback) {
request( requestOpts, function ( err, res ){
if( err ){
console.error( err );
//Check if hostname is valid. Abort execution if not
if( err.code === 'ENOTFOUND' ) {
throw new Error( 'Invalid hostname: "'+ err.hostname + '". Stopping execution.' );
}
urls.push(url);
}
else if( shouldRetryRequest(res) ){
Expand Down

0 comments on commit 92101aa

Please sign in to comment.