How to use the @sentry/node.setExtra function in @sentry/node

To help you get started, we’ve selected a few @sentry/node 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 splash-cli / splash-cli / src / client.js View on Github external
featured: Boolean(flags.featured),
					collection: flags.collection,
					orientation: flags.orientation,
				});
			}

			if (photo) {
				spinner.succeed('Connected!');

				if (Array.isArray(photo)) {
					photo = photo[0];
				}

				if (photo.errors) {
					const UnsplashError = new Error('Unsplash Error');
					Sentry.setExtra('Unsplash Error', photo.errors);
					const event_id = Sentry.captureException(UnsplashError);
					config.set('lastEventId', event_id);

					return printBlock(chalk`{bold {red ERROR:}}`, ...photo.errors);
				}

				const { url } = await Unsplash.shared.getDownloadLink(photo.id);

				await download(photo, url, flags, true);
			} else {
				spinner.fail('Unable to connect.');
			}
		} catch (error) {
			return errorHandler(error);
		}
	} else {
github integrations / jira / lib / frontend / retry-sync.js View on Github external
module.exports = async (req, res, next) => {
  const installation = res.locals.installation

  const { installationId: gitHubInstallationId, syncType } = req.body

  Sentry.setExtra('Body', req.body)

  try {
    const subscription = await Subscription.getSingleInstallation(installation.jiraHost, gitHubInstallationId)

    await Subscription.findOrStartSync(subscription, syncType)

    return res.sendStatus(202)
  } catch (error) {
    next(new Error('Unauthorized'))
  }
}
github integrations / jira / lib / frontend / app.js View on Github external
Sentry.withScope(async scope => {
      const jiraHost = (req && req.session && req.session.jiraHost) || (req && req.query && req.query.xdm_e)
      if (jiraHost) {
        scope.setTag('jiraHost', jiraHost)
      }

      if (req.body) {
        Sentry.setExtra('Body', req.body)
      }

      next(err)
    })
  }