@odg/exception
v1.5.1
Published
Exception Class with preview for Js
Downloads
368
Readme
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