sdfdf
This commit is contained in:
7
index.js
7
index.js
@@ -9,7 +9,7 @@ const express = require("express")
|
|||||||
// , { puppeteerErrors } = require("puppeteer-core/lib/cjs/puppeteer/common/Errors");
|
// , { puppeteerErrors } = require("puppeteer-core/lib/cjs/puppeteer/common/Errors");
|
||||||
|
|
||||||
|
|
||||||
logger.getContext = function getContext() {
|
logger.getContext = function () {
|
||||||
return {
|
return {
|
||||||
// hostname: hostname,
|
// hostname: hostname,
|
||||||
// pid: process.pid,
|
// pid: process.pid,
|
||||||
@@ -17,6 +17,11 @@ logger.getContext = function getContext() {
|
|||||||
app: 'Browser'
|
app: 'Browser'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
logger.throwError = function (msg, info) {
|
||||||
|
let error = new Error(msg)
|
||||||
|
error.info = info
|
||||||
|
throw error
|
||||||
|
}
|
||||||
var app = express();
|
var app = express();
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(expressLogging(logger));
|
app.use(expressLogging(logger));
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ class SeleniumBrowser {
|
|||||||
return html
|
return html
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.error({ message: err.message }, 'Get html failed')
|
|
||||||
this.pool.release(driver)
|
this.pool.release(driver)
|
||||||
|
logger.throwError(err.message, { uri: params.uri })
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return html
|
return html
|
||||||
|
|||||||
Reference in New Issue
Block a user