Browse Source

print error json to std err

fix-broken-scrape
Jørgen Sverre Lien Sellæg 4 years ago
parent
commit
514b966920
  1. 4
      src/facebook-request.mjs

4
src/facebook-request.mjs

@ -47,12 +47,16 @@ export const do_request = async (doc_id, variables, parse = true) => {
const txt = await res.text(); const txt = await res.text();
if (!res.ok) { if (!res.ok) {
console.error(txt);
return null; return null;
} }
if (parse) { if (parse) {
try { try {
res = JSON.parse(txt); res = JSON.parse(txt);
if (res.errors != null) {
console.error(JSON.stringify(res.errors));
}
} catch (e) { } catch (e) {
console.error(e); console.error(e);
return null; return null;

Loading…
Cancel
Save