mirror of
https://github.com/Lissy93/web-check.git
synced 2025-01-09 07:48:18 +01:00
Improved error handline, fixes #5
This commit is contained in:
parent
f9437ea964
commit
b2204728ea
@ -31,8 +31,8 @@ exports.handler = async (event, context, callback) => {
|
|||||||
browser = await puppeteer.launch({
|
browser = await puppeteer.launch({
|
||||||
args: chromium.args,
|
args: chromium.args,
|
||||||
defaultViewport: { width: 800, height: 600 },
|
defaultViewport: { width: 800, height: 600 },
|
||||||
executablePath: '/usr/bin/chromium',
|
// executablePath: '/usr/bin/chromium',
|
||||||
// executablePath: await chromium.executablePath(),
|
executablePath: await chromium.executablePath(),
|
||||||
headless: chromium.headless,
|
headless: chromium.headless,
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
});
|
});
|
||||||
|
@ -52,7 +52,7 @@ const useMotherOfAllHooks = <ResultType = any>(params: UseIpAddressProps<ResultT
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// Something fucked up, log the error
|
// Something fucked up, log the error
|
||||||
updateLoadingJobs(jobId, 'error', err.message, reset);
|
updateLoadingJobs(jobId, 'error', err.error || err.message, reset);
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -154,18 +154,11 @@ const Results = (): JSX.Element => {
|
|||||||
|
|
||||||
const parseJson = (response: Response): Promise<any> => {
|
const parseJson = (response: Response): Promise<any> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (response.ok) {
|
|
||||||
response.json()
|
response.json()
|
||||||
.then(data => resolve(data))
|
.then(data => resolve(data))
|
||||||
.catch(error => resolve(
|
.catch(error => resolve(
|
||||||
{ error: `Failed to process response, likely due to Netlify's 10-sec limit on lambda functions. Error: ${error}`}
|
{ error: `Failed to process response, likely due to Netlify's 10-sec limit on lambda functions. Error: ${error}`}
|
||||||
));
|
));
|
||||||
} else {
|
|
||||||
resolve(
|
|
||||||
{ error: `Response returned with status: ${response.status} ${response.statusText}.`
|
|
||||||
+ `This is likely due to an incompatibility with the lambda function.` }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user