Socket
Socket
Sign inDemoInstall

@mongosh/errors

Package Overview
Dependencies
0
Maintainers
7
Versions
109
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @mongosh/errors

MongoDB Shell Errors Package


Version published
Maintainers
7
Created

Readme

Source

@mongosh/errors

Package for MongoDB Shell

Usage

const { MongoshUnimplementedError } = require('@mongosh/errors');

function evaluate(input) {
  if (input === 'some input') {
    throw new MongoshUnimplementedError(`${input} is not implemented`);
  }
}

// throws: MongoshUnimplemetedError: some input is not implemented
evaluate('some input')

API

MongoshWarning(msg)

This error is used to give user a warning about the current execution. args:

  • msg: type string. Describes the warning.
MongoshUnimplementedError(msg)

This error is used to API endpoints that are not yet implemented. args:

  • msg: type string. Describes what is not yet implemented.
MongoshRuntimeError(msg)

Used for errors in evaluation, specific to MongoDB Shell. Should not be used for JavaScript runtime errors.

args:

  • msg: type string. Describes what caused the error and a potential fix, if avaialable.
MongoshInternalError(msg)

Used for rare cases when MongoDB Shell is not able to parse and evaluate the input. args:

  • msg: type string. Describes error in detail, so the user can better report it.

e.message will be appended with the following information:

This is an error inside Mongosh. Please file a bug report. Please include a log file from this session.
MongoshInvalidInputError(msg)

This error is used for invalid MongoDB input. This should not be used for JavaScript syntax errors, but rather for those specific to MongoDB. args:

  • msg: type string. Describes error in detail, providing current invalid input, and a fix, if available.

Installation

npm install -S @mongosh/errors

FAQs

Last updated on 15 May 2020

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc