How to use the raven.parsers function in raven

To help you get started, we’ve selected a few raven 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 withspectrum / spectrum / iris / utils / create-graphql-error-formatter.js View on Github external
const createGraphQLErrorFormatter = (req?: express$Request) => (
  error: GraphQLError
) => {
  console.log('error', error);
  const isUserError = error.originalError
    ? error.originalError[IsUserError]
    : false;
  let sentryId = 'ID only generated in production';
  if (!isUserError) {
    if (process.env.NODE_ENV === 'production') {
      sentryId = Raven.captureException(
        error,
        req && Raven.parsers.parseRequest(req)
      );
    }
  }
  return {
    message: isUserError ? error.message : `Internal server error: ${sentryId}`,
    // Hide the stack trace in production mode
    stack:
      !process.env.NODE_ENV === 'production' ? error.stack.split('\n') : null,
  };
};
github withspectrum / spectrum / iris / utils / create-graphql-error-formatter.js View on Github external
const createGraphQLErrorFormatter = (req?: express$Request) => (
  error: GraphQLError
) => {
  const isUserError = error.originalError
    ? error.originalError[IsUserError]
    : false;
  let sentryId = 'ID only generated in production';
  if (!isUserError) {
    if (process.env.NODE_ENV === 'production') {
      sentryId = Raven.captureException(
        error,
        req && Raven.parsers.parseRequest(req)
      );
    }
  }
  return {
    message: isUserError ? error.message : `Internal server error: ${sentryId}`,
    // Hide the stack trace in production mode
    stack:
      !process.env.NODE_ENV === 'production' ? error.stack.split('\n') : null,
  };
};
github artsy / metaphysics / src / lib / graphqlErrorHandler.ts View on Github external
const baseURL = req.baseUrl
  // TODO: change the href to not include variables when `variables` is null or undefined.
  const encodedVars = encodeURIComponent(JSON.stringify(variables))
  const encodedQuery = encodeURIComponent(query)
  const href = `${baseURL}/graphiql?variables=${encodedVars}&query=${encodedQuery}`

  raven.captureException(error.originalError || error, {
    tags: { graphql: "exec_error" },
    extra: {
      source: (error.source && error.source.body) || query,
      positions: error.positions,
      path: error.path,
      variables,
      href,
    },
    ...raven.parsers.parseRequest(req),
  })
}
github apilayer / numvalidate / server / services / sentry.js View on Github external
autoBreadcrumbs: true,
    captureUnhandledRejections: true,
    environment: keys.EXECUTION_ENV,
  }).install();
}

exports.log = (msg, meta) => {
  if (sentryEnabled) {
    if (meta.level === 'error' || meta.level === 'fatal') {
      Raven.captureException(msg, meta);
    }
    Raven.captureMessage(msg, meta);
  }
};

exports.parseRequest = Raven.parsers.parseRequest;
github artsy / metaphysics / src / lib / graphqlErrorHandler.js View on Github external
return (error) => {
    if (enableSentry) {
      if (shouldLogError(error.originalError)) {
        raven.captureException(
          error,
          assign(
            {},
            {
              tags: { graphql: "exec_error" },
              extra: {
                source: error.source && error.source.body,
                positions: error.positions,
                path: error.path,
              },
            },
            raven.parsers.parseRequest(req),
          ),
        )
      }
    }
    return {
      message: error.message,
      locations: error.locations,
      stack: isProduction ? null : error.stack,
    }
  }
}