Hexagonal architecture utils library
npm install @hexadrop/error
Opinionated error base class for DDD
``bash`
npm install --save @hexadrop/error
Using bun
`bash`
bun add @hexadrop/error
This package provides an opinionated base class for Domain Errors.
This is meant to be extended and used as a base class for Domain Errors.
It is opinionated in the sense that it enforces a constructor with three arguments:
- name: The name of the error.message
- : The message of the error.code
- : The code of the error. Must follow the next Regexp /[A-Z][A-Z][A-Z]\((\d{3}|\d{6})\)/.FNL(123)
For example or RPA(435678)
`typescript
import DomainError from '@hexadrop/error';
class EmptyErrorCodeError extends DomainError {
constructor() {
super('EmptyErrorCodeError', 'DomainError code can not be null or empty', 'HEX(400)');
}
}
``
Publishing this package we are committing ourselves to the following code quality standards:
- Respect Semantic Versioning: No breaking changes in patch or minor versions
- No surprises in transitive dependencies: Use the bare minimum dependencies needed to meet the purpose
- One specific purpose to meet without having to carry a bunch of unnecessary other utilities
- Tests as documentation and usage examples
- Well documented README showing how to install and use
- License favoring Open Source and collaboration