Skip to content

mikeludemann/error-classes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

error-classes

Some different classes for handling the error types and more

Examples

import { StringError, NumberError, ArrayError, ObjectError, SymbolError, NullError, BooleanError, DateError, FunctionError, ValidationError, DatabaseError, PermissionError, InternalError, ResourceNotFoundError } from 'error-classes';

...

var elem = ...;

try {
	foobar();
} catch(err) {
	throw new StringError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new NumberError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new ArrayError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new ObjectError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new SymbolError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new NullError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new BooleanError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new DateError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new FunctionError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new ValidationError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new DatabaseError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new PermissionError(err, elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new ResourceNotFoundError("test", elem);
} finally {
	console.log("...");
}

try {
	foobar();
} catch(err) {
	throw new InternalError(err);
} finally {
	console.log("...");
}

...

About

Some different classes for handling the error types and more

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy