How to use @sentry/electron - 10 common examples

To help you get started, we’ve selected a few @sentry/electron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github burtonator / polar-bookshelf / web / js / logger / SentryLogger.ts View on Github external
private static initWhenNecessary() {

        if (initialized) {
            return;
        }

        try {

            if (SentryLogger.isEnabled()) {
                init({
                    dsn: 'https://2e8b8ca6e6bf4bf58d735f2a405ecb20@sentry.io/1273707',
                    // more options...
                });
            }

            ready = true;

        } catch (e) {
            console.error("Unable to initialize sentry: ", e);
        } finally {
            initialized = true;
        }

    }
github InventivetalentDev / PluginBlueprint / main.js View on Github external
function init() {
    console.log("" +
        "PluginBlueprint, Version " + app.getVersion() + "\n" +
        "Copyright (c) 2018, Haylee Schaefer\n" +
        "All rights reserved.\n");

    crashReporter.start({
        productName: "PluginBlueprint",
        companyName: "inventivetalent",
        submitURL: "https://submit.backtrace.io/inventivetalent/194573923afb55a5b91ad7cda2868bbefaf0df605ae377a7067af7bd44f88e27/minidump",
        uploadToServer: true
    });
    Sentry.init({
        release: "PluginBlueprint@" + app.getVersion(),
        dsn: 'https://6d56f92bc4f84e44b66950ed04e92704@sentry.io/1309246'
    });

    console.log(process.argv);
    process.argv.forEach((val, index) => {
        if (val === "--debug") {
            debug = true;
            console.log("Debugging enabled");
        }
    });

    // Create the browser window.
    win = new BrowserWindow({
        title: DEFAULT_TITLE + " " + app.getVersion(),
        width: 1200,
github muffinista / before-dawn / src / main / assets / sentry.js View on Github external
const Sentry = require("@sentry/electron");

var opts = {
  dsn: "https://b86f7b0ac5604b55b4fd03adedc5d205@sentry.io/172824",
  enableNative: false,
  onFatalError: (error) => {
    // eslint-disable-next-line no-console
    console.log(error);
  },
};

if ( process.env.BEFORE_DAWN_RELEASE_NAME ) {
  opts.release = process.env.BEFORE_DAWN_RELEASE_NAME;
}

Sentry.init(opts);


if ( typeof(window) !== "undefined" ) {
  window.Sentry = Sentry;
}
github dreamnettech / dreamtime / src / gui / electron / telemetry / sentry.js View on Github external
init() {
    if (!this.can()) {
      return
    }

    const config = {
      dsn: process.env.SENTRY_DSN,
      release: process.env.npm_package_version,
      environment: process.env.NODE_ENV
    }

    // Send any error to Sentry
    Sentry.init(config)

    debug('Sentry initialized!', config)
  },
github ooni / probe-desktop / main / index.js View on Github external
const fixPath = require('fix-path')
const { getConfig } = require('./utils/config')
const { getSentryConfig } = require('./utils/sentry')

const log = require('electron-log')

const toggleWindow = require('./windows/toggle')

const {
  mainWindow,
  openAboutWindow,
  windowURL
} = require('./windows')

const Sentry = require('@sentry/electron')
Sentry.init(getSentryConfig())

require('debug-to-file')
require('electron-unhandled')()
require('electron-debug')({
  showDevTools: true,
  // null means activate it only if isDev == true. FORCE_ELECTRON_DEBUG will
  // make sure it's always enabled even in "production" builds.
  enabled: parseInt(process.env.FORCE_ELECTRON_DEBUG, 10) === 1 ? true : null
})

autoUpdater.logger = log
autoUpdater.logger.transports.file.level = 'info'
log.info('App starting...')

// To prevent garbage collection of the windows
let windows = null
github pixel-point / kube-forwarder / src / common / configure-sentry.js View on Github external
export default function configureSentry(configOverrides = {}) {
  if (!process.env.SENTRY_DSN) return

  Sentry.init({
    release: `${packageJson.name}@${packageJson.version}`,
    dsn: process.env.SENTRY_DSN,
    defaultIntegrations: false,
    async beforeSend(event) {
      // Ignore Errors with sentryIgnore == true
      if (event.extra && event.extra.Error && event.extra.Error.sentryIgnore) return null

      if (event.exception && event.exception.values && event.exception.values[0]) {
        const value = event.exception.values[0]

        // ignore Socket error.
        if (value.type === 'Error' && value.value === 'This socket has been ended by the other party') return null
      }

      // Send errors only in production mode.
      if (process.env.NODE_ENV === 'production') return event
github web-pal / chronos-timetracker / app / renderer / sagas / timer.js View on Github external
) {
      const screenshotTime = yield eff.select(getUiState('screenshotTime'));
      const screenshotTimeId = yield eff.select(getUiState('screenshotTimeId'));
      /* In casee of render freeze, if it will happen often, shift it to the main process */
      if (time >= screenshotTime) {
        if (prevScreenshotId !== screenshotTimeId) {
          prevScreenshotId = screenshotTimeId;
          yield eff.put(screenshotsActions.takeScreenshotRequest({
            isTest: false,
            time,
            timestamp: new Date().getTime(),
          }));
          if (time !== screenshotTime) {
            console.log('TIME !== SCREENSHOTTIME');
            console.log(`time: ${time}, screenshotTime: ${screenshotTime}`);
            Sentry.captureMessage(
              `time !== screenshotTime, time: ${time}, screenshotTime: ${screenshotTime}`,
            );
          }
        }
      }
    }
  }
}
github Jigsaw-Code / outline-server / src / server_manager / electron_app / index.ts View on Github external
shouldAddBreadcrumb: (breadcrumb) => {
    // Don't submit breadcrumbs for console.debug.
    if (breadcrumb.category === 'console') {
      if (breadcrumb.level === sentry.Severity.Debug) {
        return false;
      }
    }
    return true;
  },
  beforeBreadcrumb: (breadcrumb) => {
github pixel-point / kube-forwarder / src / renderer / components / ClusterAdd.vue View on Github external
const messages = errors.map(({ error, contextName }) => {
        // TODO a breadcrumb for originError
        Sentry.captureException(error)
        return this.getConnectionErrorMessage(error, contextName)
      })
github MozillaSecurity / virgo / src / renderer / components / Error / ErrorBoundary.jsx View on Github external
Sentry.withScope(scope => {
        scope.setExtra(errorInfo)
        this.setState({ eventId: Sentry.captureException(error) })
      })
      /* Collect user feedback as follow up. */