@carthage-js/graou
v1.2.0
Published
Avoid wolf in code with this library to design better error management.
Downloads
563
Maintainers
Readme
Graou
🐺 What is Graou?
Graou is a lightweight TypeScript library that aims to provide a clean, structured, and reusable approach to creating and managing application errors instead of handling exceptions in an inconsistent way throughout the codebase.
[!NOTE] Check our examples to see our way to use it 😀 examples
How to use ? (Quickstart)
[!NOTE] We got a ⭐ wiki ⭐ that go deeper in the explaination.
const graou = require("@carthage-js/graou");
const errorsFactory = graou.makeModuleErrorsFactory({
moduleName: "<SHOULD REFERE TO YOUR name FIELD OF package.json>",
});
const errors = errorsFactory("<SCOPE NAME>", ["<CODE NAME>", "<OTHER CODE NAME>"]);
// Use errors like that:
throw errors.codes.<CODE NAME>.factory("<YOUR REASON>");
throw errors.codes.<CODE NAME>.factory("<YOUR REASON>", { cause: "<PASS THE PARENT EXCEPTION HERE>" })