@cdellacqua/serializable-error
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.4 • Public • Published

    serializable-error

    Custom error class that supports JSON serialization and concatenation

    NPM Package

    npm install @cdellacqua/serializable-error

    Full documentation:

    Highlights

    Keep track of what caused the error

    try {
    	someFunctionThatThrows();
    } catch (err) {
    	// some error handling logic
    	// ...
    	throw new SerializableError('something more specific about the current exception', err);
    }
    

    Exception logging

    try {
    	someFunctionThatThrows();
    } catch (err) {
    	logger.log(SerializableError.from(err));
    	// or, if it only accepts strings
    	logger.log(JSON.stringify(SerializableError.from(err)));
    	throw err;
    }
    

    Install

    npm i @cdellacqua/serializable-error

    DownloadsWeekly Downloads

    4

    Version

    1.1.4

    License

    MIT

    Unpacked Size

    9.4 kB

    Total Files

    8

    Last publish

    Collaborators

    • cdellacqua