Skip to content
This repository was archived by the owner on Oct 19, 2019. It is now read-only.

Commit 9b4589a

Browse files
committed
added showError config flag; update tests
1 parent 1803340 commit 9b4589a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/Scrapper.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class Scrapper {
5555
options: this.runnerOptions
5656
});
5757
} catch(err) {
58-
console.log(err);
58+
if (config.showError)
59+
console.error(err);
5960
info = null; //new Error(1);
6061
}
6162
return new Scrap({

lib/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
puppeteer: {
33
headless: true
4-
}
4+
},
5+
showError: false
56
};

test.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const { config, scrappers, classes: { StreamInfo, HosterInfo }} = require('./index.js');
22

33
(async () => {
4+
config.showError = true;
5+
46
//config.puppeteer.headless = false;
57
//config.puppeteer.executablePath = 'C:\\Users\\Admin\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe';
8+
config.puppeteer.args = ['--no-sandbox', '--disable-setuid-sandbox'];
69

710
const urls = [
811
'https://openload.co/embed/zRpmqpRRaac/YuGiOhArcVEpisode123-rh-480.x.mp4',
@@ -35,9 +38,11 @@ const { config, scrappers, classes: { StreamInfo, HosterInfo }} = require('./ind
3538
}
3639
} catch (err) {
3740
allSuccess = false;
38-
console.log(err);
39-
throw 'Unexpected error during testing';
41+
if (config.showError)
42+
console.error(err);
43+
console.error('Unexpected error during testing');
4044
}
4145
if (!allSuccess)
42-
throw ''
46+
process.exit(1);
47+
process.exit(0);
4348
})();

0 commit comments

Comments
 (0)