Collection of common exception classes for JavaScript, written in TypeScript and running in the browser and NodeJS.
$ npm install --save grexcept
or
$ yarn add grexcept
To view all details about the classes including their attributes, please see /Docs or follow this link: Docs.
Baseclass of all other exception classes.
import {Exception} from 'grexcept';
new Exception(message: string, cause?: Error)
Exception.fromObject(ex: any): Error
// wrapps object inside a exception object if object is not already a exception or error
Exception.isError(ex: any): ex is Error
// returns true for objects which implement the error-shape
Exception that will be thrown if multiple errors occurred.
import {AggregateException} from 'grexcept';
new AggregateException(innerExceptions: Error | Error[], message?: string)
new AggregateException(innerExceptions: Error | Error[])
Exception that will be thrown if a value is invalid.
import {ArgumentException} from 'grexcept';
new ArgumentException(argumentName: PropertyKey, message?: string, cause?: Error)
new ArgumentException(argumentName: PropertyKey, cause?: Error)
Exception that will be thrown if a value is null or undefined.
import {ArgumentNullException} from 'grexcept';
new ArgumentNullException(argumentName: PropertyKey, message?: string, cause?: Error)
new ArgumentNullException(argumentName: PropertyKey, cause?: Error)
Exception that will be thrown if a value is out of a range.
import {ArgumentOutOfRangeException} from 'grexcept';
new ArgumentOutOfRangeException(argumentName: PropertyKey, actualValue: any, message?: string, cause?: Error)
new ArgumentOutOfRangeException(argumentName: PropertyKey, actualValue: any, cause?: Error)
Exception that will be thrown if a plain object is thrown somewhere else.
import {ChuckNorrisException} from 'grexcept';
new ChuckNorrisException(exceptionObject: any)
Exception that will be thrown if a call of a method is invalid because of the current state of the object.
import {InvalidOperationException} from 'grexcept';
new InvalidOperationException(message?: string, cause?: Error)
new InvalidOperationException(cause?: Error)
Exception that will be thrown if an object or string doesn't fulfill the excepted format.
import {InvalidFormatException} from 'grexcept';
new InvalidFormatException(message?: string, cause?: Error)
new InvalidFormatException(cause?: Error)
Exception that will be thrown if an input or output error occurred.
import {IOException} from 'grexcept';
new IOException(message?: string, cause?: Error)
new IOException(cause?: Error)
Exception that will be thrown if some resource or entity was not found.
import {NotFoundException} from 'grexcept';
new NotFoundException(entity: string | (new (...args: any[]) => any), message?: string, cause?: Error)
new NotFoundException(entity: string | (new (...args: any[]) => any), cause?: Error)
Exception that will be thrown if some method or operation is not implemented.
import {NotImplementedException} from 'grexcept';
new NotImplementedException(message?: string, cause?: Error)
new NotImplementedException(cause?: Error)
Exception that will be thrown if the callee is not permitted to execute this method or operation.
import {NotPermittedException} from 'grexcept';
new NotPermittedException(message?: string, cause?: Error)
new NotPermittedException(cause?: Error)
Exception that will be thrown if the called method or operation is not supported.
import {NotSupportedException} from 'grexcept';
new NotSupportedException(message?: string, cause?: Error)
new NotSupportedException(cause?: Error)
Exception that will be thrown if an operation is invalid because the object is already disposed.
import {ObjectDisposedException} from 'grexcept';
new ObjectDisposedException(objectName: string, message?: string, cause?: Error)
new ObjectDisposedException(objectName: string, cause?: Error)
import {OperationAbortedException} from 'grexcept';
new OperationAbortedException(reason?: string, cause?: Error)
new OperationAbortedException(cause?: Error)
Exception that will be thrown if a timeout has been reached and an operation was canceled.
import {TimeoutException} from 'grexcept';
new TimeoutException(timeout: number, reason?: string, cause?: Error)
new TimeoutException(timeout: number, cause?: Error)
Exception that will be thrown if a validation of some argument failed.
import {ValidationException} from 'grexcept';
new ValidationException(message?: string, cause?: Error)
new ValidationException(cause?: Error)