nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit c32e0526cb1684cd76dcaaf79201bfee09a8d1d4
parent 8226d98bd3cdf9caf9ef0315ac8ba0a21e2ed3c5
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sun,  5 Mar 2017 14:28:45 +0300

added raven-js for logging errors to sentry.io

Diffstat:
Mpackage.json | 1+
Msrc/index.js | 11+++++++++++
Asrc/lib/logging/index.js | 16++++++++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/package.json b/package.json @@ -60,6 +60,7 @@ "knockout": "^3.4.0", "leaflet": "1.0.3", "load-script": "^1.0.0", + "raven-js": "^3.12.0", "rbush": "^2.0.1", "utf8": "^2.1.2" }, diff --git a/src/index.js b/src/index.js @@ -1,5 +1,16 @@ +import Raven from 'raven-js'; import './index.css'; import App from './App' +import config from './config'; + +Raven.config(config.sentryDSN).install(); +window.addEventListener('unhandledrejection', (e) => { + const err = e.reason; + if (err.name) { + err.name = 'Uncaught in promise: ' + err.name; + } + Raven.captureException(err); +}); App.setUp(); diff --git a/src/lib/logging/index.js b/src/lib/logging/index.js @@ -0,0 +1,15 @@ +import Raven from 'raven-js'; + +function captureException(e) { + Raven.captureException(e) +} + +function captureMessage(msg) { + Raven.captureMessage(msg) +} + +function setExtraContext(data) { + Raven.setExtraContext(data) +} + +export default {captureMessage, captureException, setExtraContext} +\ No newline at end of file