exception-methods

Set of exception messages.

Usage no npm install needed!

<script type="module">
  import exceptionMethods from 'https://cdn.skypack.dev/exception-methods';
</script>

README

exception-methods

Set of exception messages for JavaScript.

Installation

To install the stable version:

npm install --save exception-methods

The Gist

import * as exceptionMethods from 'exception-methods';

console.log(exceptionMethods.argumentException('age', 'ageValue'));
console.log(exceptionMethods.invalidOperationException());
console.log(exceptionMethods.notImplementedException());
console.log(exceptionMethods.rangeException('age', -10));
console.log(exceptionMethods.typeException());
console.log(exceptionMethods.URIException());
console.log(exceptionMethods.customException('Custom Exception'));

API

Method Description
argumentException An exception that is useful for throwing or reporting exceptions related to function arguments
invalidOperationException An exception that is useful for throwing or reporting exceptions related to invalid operations
notImplementedException An exception that is useful for throwing or reporting exceptions related to unimplemented code
rangeException An exception that is useful for throwing or reporting exceptions related to range errors
typeException An exception that is useful for throwing or reporting exceptions related to type errors
URIException An exception that is useful for throwing or reporting exceptions related to URI errors

Examples

License

MIT