xdl
Version:
The Expo Development Library
35 lines (29 loc) • 763 B
Flow
/**
* @flow
*/
let Raven;
let SENTRY_DSN;
if (global.XMLHttpRequest) {
// use browser version and DSN for xde
Raven = require('raven-js');
SENTRY_DSN = 'https://8554f14d112d4ed4b0558154762760ef@sentry.io/194120';
} else {
// use node version and DSN for crna and exp
Raven = require('raven');
SENTRY_DSN = `
https://8554f14d112d4ed4b0558154762760ef:bae5673d5e5243abac5563d70861b5d8@sentry.io/194120
`;
}
Raven.config(SENTRY_DSN).install();
type TagType = {
[key: string]: string,
};
export function logError(message: string, { tags }: { tags: TagType }): void {
// send error to Sentry
// add `testing: true` to tags to avoid sending an email when testing
Raven.captureMessage(message, {
tags: {
...tags,
},
});
}