New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

seal-assert-mongo-error

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seal-assert-mongo-error

Throws on a servere mongodb error.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

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

seal-assert-mongo-error

If called with a mongodb error of a predefined (severe error) code it throws the error.

Default list of mongodb error codes to throw:

NameCode
InternalError1
HostUnreachable6
HostNotFound7
NetworkTimeout89
SocketException9001
UnknownError8
ProtocolError17
IllegalOpMsgFlag223
UserNotFound11
Unauthorized13
AuthenticationFailed18
InvalidSSLConfiguration140
SSLHandshakeFailed141
OutOfDiskSpace14031

Installation

$ npm install seal-assert-mongo-error

Quick start

First you need to add a reference to seal-assert-mongo-error within your application, then call the assert function in the callback of every mongodb call.

const assertMongoError = require('seal-assert-mongo-error');

yourCollection.find({}, (findError, cursor) => {
  assertMongoError.assert(findError);
  ...
});

Set list of error codes

Use the setCodes function to set a new list of error codes. This needs to be done only once, e.g. at startup. The new list is available instantly throughout the whole node process.

const assertMongoError = require('seal-assert-mongo-error');

assertMongoError.setCodes([1,2,3]);
...
assertMongoError.assert(mongoErrorObject);

Running the build

To build this module use roboter.

$ bot

FAQs

Package last updated on 06 Oct 2017

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