mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-10 06:44:13 +00:00
capture caught exceptions (#37)
* capture caught exceptions * fix package.json typo
This commit is contained in:
parent
52ae82a5cc
commit
1b7aa3258c
2 changed files with 8 additions and 4 deletions
10
api.js
10
api.js
|
@ -22,6 +22,7 @@ const get_hashed_password = require('./utils.js').get_hashed_password;
|
||||||
const get_secure_random_string = require('./utils.js').get_secure_random_string;
|
const get_secure_random_string = require('./utils.js').get_secure_random_string;
|
||||||
const {google} = require('googleapis');
|
const {google} = require('googleapis');
|
||||||
const {OAuth2Client} = require('google-auth-library');
|
const {OAuth2Client} = require('google-auth-library');
|
||||||
|
const Sentry = require('@sentry/node');
|
||||||
|
|
||||||
|
|
||||||
const SCREENSHOTS_DIR = path.resolve(process.env.SCREENSHOTS_DIR);
|
const SCREENSHOTS_DIR = path.resolve(process.env.SCREENSHOTS_DIR);
|
||||||
|
@ -200,7 +201,8 @@ async function set_up_api_server(app) {
|
||||||
req.session.authenticated = true;
|
req.session.authenticated = true;
|
||||||
res.redirect("/app/");
|
res.redirect("/app/");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Error Occured: ${error}`);
|
console.error(`Error Occured: ${error}`);
|
||||||
|
Sentry.captureException(error);
|
||||||
res.status(500).send("Error Occured. We're seeing a lot of traffic now. Please try again soon.");
|
res.status(500).send("Error Occured. We're seeing a lot of traffic now. Please try again soon.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -228,10 +230,11 @@ async function set_up_api_server(app) {
|
||||||
res.set('Content-Encoding', 'gzip');
|
res.set('Content-Encoding', 'gzip');
|
||||||
res.set('Content-Type', 'image/png');
|
res.set('Content-Type', 'image/png');
|
||||||
res.send(image);
|
res.send(image);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Sentry.captureException(error);
|
||||||
res.status(404).send(`Error retrieving image from GCS`);
|
res.status(404).send(`Error retrieving image from GCS`);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
const image_exists = await check_file_exists(gz_image_path);
|
const image_exists = await check_file_exists(gz_image_path);
|
||||||
|
|
||||||
|
@ -617,6 +620,7 @@ async function set_up_api_server(app) {
|
||||||
}).end();
|
}).end();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Sentry.captureException(e);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
"success": false,
|
"success": false,
|
||||||
"error": "An unexpected error occurred.",
|
"error": "An unexpected error occurred.",
|
||||||
|
|
|
@ -38,6 +38,6 @@
|
||||||
"vue-moment": "^4.1.0"
|
"vue-moment": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^29.4.1",
|
"jest": "^29.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue