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

logged-errors

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logged-errors

restify component (errors), extracted from "restify" with additional chainable features

  • 2.8.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

logged-errors

This module is a simple fork of the restify-errors with some chainable features:

  • it can log the error using an external logger (e.g. winston)
  • it can show the error stack in the body of the error
  • it can format the log output
  • it works both in Node and browser

Installation

Install logged-errors as usual:

$ npm install --save logged-errors

For browser environment add logged-error.js file in build folder.

Example

// see the examples folder

// dependencies
var LoggedErrors = require('logged-errors');

// add the stack to the body of the error
throw new LoggedErrors.NotFoundError('some error').withStack().log();

// the following statements are equivalent
throw new LoggedErrors.NotFoundError('some error').withStack().toArray().log();
throw new LoggedErrors.NotFoundError('some error').withStack(true).log();

// set a new formatter and your logger (default is console)
LoggedErrors.set({
    formatter: function (e) {
        return 'error occurred: ' + e.message;
    }
});

For other information please refer to restify documentation.

FAQs

Package last updated on 25 May 2014

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