Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ansaro/micro-raven-errors

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ansaro/micro-raven-errors

A tiny module for sending Raven errors using Zeit's micro server framework

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
2
Weekly downloads
 
Created
Source

micro-raven-errors - Micro wrapper for capturing application errors with Raven

Installation

yarn add @ansaro-ai/micro-raven-errors

Usage

micro-raven-errors exports a single function that wraps a micro services, and captures any errors with an http status of 500 or greater with Raven.

MicroRavenErrors: (fn: MicroFunction, dsn: string) => MicroFunction

type MicroFunction = (req http.IncomingMessage, reshttp.ServerResponse) => any

fn: A function that could otherwise run standalone inside micro. This is your application code.

dsn: The Data Source Name is a URL where Sentry listens to collect errors from your application.

const micro = require("micro")
const MicroRavenErrors = require("@ansaro-ai/micro-raven-errors");

const testServer = async (req, res) => {
  const body = await micro.json(req);

  if (!body.name) {
    throw micro.createError(400);
  }

  if (body.massiveError) {
    throw micro.createError(500, "This is a massive error");
  }

  return { success: true };
};

module.exports = MicroRavenErrors(testServer, "YOUR_RAVEN_DSN")

FAQs

Package last updated on 01 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc