Humanized stack traces for the Error class
npm install herro


Humanized stack traces for the Error class: show instead of node_modules/, and add a footer with cwd, node version, and ISO date.
Example:
```
Error: something broke
at Context.
at callFn (jest@29.7.0/lib/runnable.js:266:21)
at Test.Runnable.run (jest@29.7.0/lib/runner.js:259:7)
...
--
cwd /Users/you/code/your-app
node-v20.10.0 2025-02-07T12:00:00.000Z
- Replaces cwd with . and node_modules/ with
- Appends cwd, node version, and ISO date to the stack
---
`bash`
npm install herro
Requires Node.js ≥20.
---
Built in TypeScript; types are included.
Error subclass whose instances get humanized stack traces. Use with new only.
`ts
import { Herror } from 'herro';
throw new Herror('something broke');
`
When flag is truthy or omitted, all stack traces (including plain Error) use the humanized format. When flag is false, restores the default format.
`ts
import { global } from 'herro';
global(); // enable humanized stacks globally
global(false); // revert to default format
`
- npmize(stack: string): string – transform a stack string to pathsformatStack(stack: string): string
- – npmize and append cwd / node version / date footer
---
| Command | Description |
|-------------------|----------------------------|
| npm run dist | Build TypeScript to dist/ |npm run lint
| | Run ESLint |npm test
| | Run Jest + verify-publish |npm run clean
| | Remove verify-publish artifacts and *.tgz` |
---
The MIT License (MIT)
Copyright (c) 2017-present Javier Carrillo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.