Ignorar reportes de error de bots

closes sutty/sutty#2740
This commit is contained in:
f 2021-09-19 12:56:05 -03:00 committed by Nulo
parent b4e0504f97
commit 9d2d811b10
3 changed files with 23 additions and 9 deletions

View file

@ -1,5 +1,11 @@
import BotDetector from 'device-detector-js/dist/parsers/bot'
import { Notifier } from '@airbrake/browser' import { Notifier } from '@airbrake/browser'
if ('userAgent' in navigator) {
window.bot_detector = new BotDetector
const bot = window.bot_detector.parse(navigator.userAgent)
if (!bot) {
window.airbrake = new Notifier({ window.airbrake = new Notifier({
projectId: window.env.AIRBRAKE_PROJECT_ID, projectId: window.env.AIRBRAKE_PROJECT_ID,
projectKey: window.env.AIRBRAKE_PROJECT_KEY, projectKey: window.env.AIRBRAKE_PROJECT_KEY,
@ -11,6 +17,8 @@ console.error = (...e) => {
window.airbrake.notify(e.join(' ')) window.airbrake.notify(e.join(' '))
return console.originalError(...e) return console.originalError(...e)
} }
}
}
import 'core-js/stable' import 'core-js/stable'
import 'regenerator-runtime/runtime' import 'regenerator-runtime/runtime'

View file

@ -16,6 +16,7 @@
"axe-core": "^4.1.2", "axe-core": "^4.1.2",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"device-detector-js": "^2.2.10",
"dotenv-webpack": "^6.0.0", "dotenv-webpack": "^6.0.0",
"liquidjs": "^9.14.0", "liquidjs": "^9.14.0",
"regenerator-runtime": "^0.13.5", "regenerator-runtime": "^0.13.5",

View file

@ -2519,6 +2519,11 @@ detect-node@^2.0.4:
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1"
integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==
device-detector-js@^2.2.10:
version "2.2.10"
resolved "https://registry.yarnpkg.com/device-detector-js/-/device-detector-js-2.2.10.tgz#a8fd47837ce89024d7647a4ddf18154d7a920538"
integrity sha512-zLcDSU10WIqbARXecaVJJxx0ZuGWq+MVhj9f9qehdBCFr9RMa5mQGTt2IZNIgKuCIind/j/DzRDViEdc2FfBGQ==
diffie-hellman@^5.0.0: diffie-hellman@^5.0.0:
version "5.0.3" version "5.0.3"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"