not-enough-errors

Table of content

Installation

$ npm install not-enough-errors

Errors

Name Description
ArgumentError Thrown when a non-null argument that is passed to a method is invalid
ArgumentNullError Thrown when null argument is passed to a method
ArgumentOutOfRangeError Thrown when the value of an argument is outside the range of valid values
FileNotFoundError Thrown when a physical file does not exist at the specified location
KeyNotFoundError Thrown when the key specified for accessing an element in a collection does not match any key in the collection
NotImplementedError Thrown when a requested function is not implemented


Base error

The base class for all errors of this library.

abstract class BaseError extends Error


Argument error

Thrown when a non-null argument that is passed to a method is invalid
See an example here

class ArgumentError extends BaseError

Constructor

public constructor(paramName: string, message?: string)
Name Type Description
paramName string The name of the parameter that causes this error
message string | undefined The error message


Argument null error

Thrown when null argument is passed to a method
See an example here

class ArgumentNullError extends ArgumentError

Constructor

public constructor(paramName: string, message?: string)
Name Type Description
paramName string The name of the parameter that causes this error
message string | undefined The error message


Argument out of range error

Thrown when the value of an argument is outside the range of valid values
See an example here

class ArgumentOutOfRangeError extends ArgumentError

Constructor

public constructor(paramName: string, message?: string)
Name Type Description
paramName string The name of the parameter that causes this error
message string | undefined The error message


File not found error

Thrown when a physical file does not exist at the specified location
See an example here

class FileNotFoundError extends BaseError

Constructor

public constructor(fileName: string, message?: string)
Name Type Description
fileName string The file name that cannot be found
message string | undefined The error message


Key not found error

Thrown when the key specified for accessing an element in a collection does not match any key in the collection
See an example here

class KeyNotFoundError extends BaseError

Constructor

public constructor(key: string, message?: string)
Name Type Description
key string The key that causes this error
message string | undefined The error message


Not implemented error

Thrown when a requested function is not implemented
See an example here

class NotImplementedError extends BaseError

Constructor

public constructor(fileName: string, message?: string)
Name Type Description
funcName string | undefined The name of the function
message string | undefined The error message

License

This project is MIT licensed.