1.5.1 โข Published 7 months ago
@odg/exception v1.5.1
Table of Contents
๐ Benefits
- ๐ Instance Error with previews error
- ๐ Code quality guaranteed
๐ Libraries
๐ Dependencies
- Node.js 16 or later
- Yarn Optional/Recommended
- ODG TsConfig Last Version
โฉ Get Started
๐ Installation
Run commands:
yarn add @odg/exception
๐ป Prepare To Develop
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)
}
๐ Start Project
First install dependencies with the following command
yarn install
# or
npm install
๐จ Build and Run
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
๐งช Teste Code
To Test execute this command
yarn test
# or
yarn test:watch