- ๐ Instance Error with previews error
- ๐ Code quality guaranteed
- Node.js 16 or later
- Yarn Optional/Recommended
- ODG TsConfig Last Version
Run commands:
yarn add @odg/exception
Create custom exception
import { Exception } from "@odg/exception";
class MyException extends Exception {
}
Instance Exception
try {
// code
} catch (error) {
throw new MyException("message", error, "EXCEPTION_CODE");
}
Props
interface Exception {
message: string; // Message of exception
code?: string | number; // Code of exception
stack: string; // Stack of Exception
preview?: UnknownException; // Preview exception parsed to UnknownException class
original?: unknown // Original Preview Exception (Error, Exception, string, unknown)
}
First install dependencies with the following command
yarn install
# or
npm install
To build the project, you can use the following command
if you change files, you need to run
yarn build
andyarn test
again
yarn build && yarn test
To Test execute this command
yarn test
# or
yarn test:watch