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

circuit-breaker-as-promised

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circuit-breaker-as-promised

Hysterix-like circuit breaker with promise api

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

circuit-breaker-as-promised

js-standard-style Circle CI Dependency Status

Hysterix-like circuit breaker for Javascript which wraps circuit-breaker-js and uses promises (via bluebird)

Installation

npm install --save circuit-breaker-as-promised

Usage

var request = require('http-as-promised')
var wrapWithBreaker = require('circuit-breaker-as-promised')
var BreakerOpen = wrapWithBreaker.BreakerOpen

var breakerRequest = wrapWithBreaker(request)

... Use as normal

breakerRequest('http://lol.com')
.catch(BreakerOpen, function () {
  // Do stuff if you need to know when the breaker is open
})

You often don't want, e.g., http client errors, to trip the breaker, but still reject the returned promise as in the following example.

var breakerRequest = wrapWithBreaker(request, function (res) {
  return res.catch(request.error.client)
})

Keywords

FAQs

Package last updated on 21 Jul 2015

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