1.7.1 โข Published 7 months ago
@odg/exception v1.7.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");
}make Exception
try {
// code
} catch (error) {
throw Exception.parse({
anythingStatus: "FAILED",
anything2: "anything"
});
}Props
interface Exception {
message: string; // Message of exception
code?: string | number; // Code of exception
stack: string; // Stack of Exception
original?: unknown // Original Preview Exception (Error, Exception, string, unknown)
getPrevious(): Exception | undefined; // Preview exception parsed to UnknownException class
}๐ 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 buildandyarn testagain
yarn build && yarn test๐งช Teste Code
To Test execute this command
yarn test
# or
yarn test:watch