grover 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/grover/js/processor.js +30 -1
- data/lib/grover/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2409cbc42fc0fcb80876e1d4238f08cfbeae1d7fc7dada4cb958e8178bafc95
|
4
|
+
data.tar.gz: 8189bc362f4979028340f17095c0e9aade0d7950f605fb2062740452316e2b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed3057d89a650c43dbd5c606edcef96e31702cde46a18896af692aaa0b000c2824df2cc90d33e2a8767486940cc4063a2c28bdd609b459579d698fb282465b4
|
7
|
+
data.tar.gz: 23ede80fa749b4095cf94733690d398fd5027c33a1d11adccc63fa3300dbc2cf89e466c6ff8e8b63be6f67a3a00eff91d9c3c9124ea98d37ef4ab86df439fb3d
|
data/lib/grover/js/processor.js
CHANGED
@@ -11,7 +11,7 @@ try {
|
|
11
11
|
process.stdout.write("[\"ok\"]\n");
|
12
12
|
|
13
13
|
const _processPage = (async (convertAction, urlOrHtml, options) => {
|
14
|
-
let browser;
|
14
|
+
let browser, errors = [];
|
15
15
|
try {
|
16
16
|
const launchParams = {
|
17
17
|
args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox', '--disable-setuid-sandbox'] : []
|
@@ -124,6 +124,18 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
|
|
124
124
|
page.setGeolocation(geolocation);
|
125
125
|
}
|
126
126
|
|
127
|
+
const raiseOnRequestFailure = options.raiseOnRequestFailure; delete options.raiseOnRequestFailure;
|
128
|
+
if (raiseOnRequestFailure) {
|
129
|
+
page.on('requestfinished', (request) => {
|
130
|
+
if (request.response() && !request.response().ok() && !request.redirectChain().length > 0) {
|
131
|
+
errors.push(request);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
page.on('requestfailed', (request) => {
|
135
|
+
errors.push(request);
|
136
|
+
});
|
137
|
+
}
|
138
|
+
|
127
139
|
const waitUntil = options.waitUntil; delete options.waitUntil;
|
128
140
|
if (urlOrHtml.match(/^http/i)) {
|
129
141
|
// Request is for a URL, so request it
|
@@ -190,6 +202,23 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
|
|
190
202
|
await page.hover(hoverSelector);
|
191
203
|
}
|
192
204
|
|
205
|
+
if (errors.length > 0) {
|
206
|
+
function RequestFailedError(errors) {
|
207
|
+
this.name = "RequestFailedError";
|
208
|
+
this.message = errors.map(e => {
|
209
|
+
if (e.failure()) {
|
210
|
+
return e.failure().errorText + " at " + e.url();
|
211
|
+
} else if (e.response() && e.response().status()) {
|
212
|
+
return e.response().status() + " " + e.url();
|
213
|
+
} else {
|
214
|
+
return "UnknownError " + e.url()
|
215
|
+
}
|
216
|
+
}).join("\n");
|
217
|
+
}
|
218
|
+
RequestFailedError.prototype = Error.prototype;
|
219
|
+
throw new RequestFailedError(errors);
|
220
|
+
}
|
221
|
+
|
193
222
|
// If we're running puppeteer in headless mode, return the converted PDF
|
194
223
|
if (debug === undefined || (typeof debug === 'object' && (debug.headless === undefined || debug.headless))) {
|
195
224
|
return await page[convertAction](options);
|
data/lib/grover/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Bromwich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: combine_pdf
|