Gathering detailed insights and metrics for @visulima/error
Gathering detailed insights and metrics for @visulima/error
Gathering detailed insights and metrics for @visulima/error
Gathering detailed insights and metrics for @visulima/error
@visulima/pail
Highly configurable Logger for Node.js, Edge and Browser.
@ffras4vnpm/enim-recusandae-assumenda
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
@wemnyelezxnpm/nisi-sunt-vero
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
@micromint1npm/voluptate-incidunt-occaecati
<p align="center"> <a href="https://visulima.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset=""> <img src="" height="128"> </picture> <h1 align="center">Visulima</h1> </a> </p>
Visulima is the next-gen JavaScript framework for JAMStack blogs, sites & apps.
npm install @visulima/error
Typescript
Module System
Min. Node Version
Node Version
NPM Version
@visulima/cerebro@1.1.46
Updated on Jun 04, 2025
@visulima/boxen@2.0.2
Updated on Jun 04, 2025
@visulima/pail@2.1.25
Updated on Jun 04, 2025
@visulima/api-platform@3.0.44
Updated on Jun 04, 2025
@visulima/jsdoc-open-api@2.0.81
Updated on Jun 04, 2025
@visulima/find-cache-dir@1.0.31
Updated on Jun 04, 2025
TypeScript (93.51%)
JavaScript (5.17%)
MDX (1.02%)
Handlebars (0.14%)
Shell (0.08%)
CSS (0.08%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
16 Stars
2,703 Commits
3 Forks
2 Watchers
17 Branches
2 Contributors
Updated on Jun 10, 2025
Latest Version
4.4.18
Package Id
@visulima/error@4.4.18
Unpacked Size
116.57 kB
Size
28.83 kB
File Count
41
NPM Version
10.9.2
Node Version
18.20.8
Published on
Jun 04, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
Error with more than just a message, stacktrace parsing and sourcemap loading.
[][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
1npm install @visulima/error
1yarn add @visulima/error
1pnpm add @visulima/error
1import { VisulimaError } from "@visulima/error"; 2 3class MyError extends VisulimaError { 4 constructor(message: string) { 5 super({ 6 name: "MyError", 7 message, 8 }); 9 } 10} 11 12throw new MyError("My error message"); 13 14// or 15 16const error = new MyError("My error message"); 17 18error.hint = "My error hint"; 19 20throw error;
1import { getErrorCauses } from "@visulima/error"; 2 3const error = new Error("My error message"); 4const error2 = new Error("Nested Error"); 5 6error.cause = error2; 7 8// The getErrorCauses function will return an array of all causes in the error in the order they occurred. 9const causes = getErrorCauses(error); 10 11console.log(causes); 12 13// [ 14// { 15// message: "My error message", 16// name: "Error", 17// stack: "Error: My error message\n at Object.<anonymous> (/visulima/packages/error/src/index.ts:2:16)", 18// }, 19// { 20// message: "Nested Error", 21// name: "Error", 22// stack: "Error: Nested Error\n at Object.<anonymous> (/visulima/packages/error/src/index.ts:3:16)", 23// }, 24// ];
Display a pretty code frame with the error location.
Note: Tabs can be used in the source code, codeFrame transforms them to spaces based on the tabWidth option. The default tabWidth is 4, to disable the transformation, set tabWidth to false.
1import { codeFrame } from "@visulima/error"; 2 3const source = "const x = 10;\nconst error = x.y;\n"; 4const loc = { column: 16, line: 2 }; 5 6const frame = codeFrame(source, { start: loc }); 7 8console.log(frame); 9// 1 | const x = 10; 10// > 2 | const error = x.y; 11// | ^
Type: string
The source code to frame.
Type: object
The location of the error.
Type: object
The location of the start of the frame.
Type: number
The line number of the error.
Type: number
The column number of the error.
Type: object
The location of the end of the frame.
Type: number
The line number of the error.
Type: number
The column number of the error.
Type: object
Type: number
Default: 2
The number of lines to show above the error.
Type: number
Default: 3
The number of lines to show below the error.
Type: number
| false
Default: 4
Browser older than 6 years are not supported.
Currently supported browsers/platforms:
1import { parseStacktrace } from "@visulima/error"; 2 3const error = new Error("My error message"); 4 5const stack = parseStacktrace(error); 6 7console.log(stack); 8 9// [ 10// { 11// column: 16, 12// file: "file:///Users/danielbannert/Projects/visulima/packages/error/src/index.ts", 13// line: 2, 14// methodName: "Object.<anonymous>", 15// raw: " at Object.<anonymous> (/visulima/packages/error/src/index.ts:2:16)", 16// type: undefined, // optional property, can be undefined, "eval", "native", or "internal" 17// evalOrigin: undefined, // optional property only available if the stacktrace contains eval 18// }, 19// ...and so on 20// ];
Type: Error
The error to parse.
Type: object
Type: Function
A function to filter the stack frames.
Type: number
The maximum number of frames to parse.
serialize
an error object1import { serializeError } from "@visulima/error"; 2 3const error = new TypeError("example"); 4const errorObject = serializeError(error); 5// Plain object: { name: 'TypeError', message: 'example', stack: '...' } 6 7const errorString = JSON.stringify(errorObject); 8const newErrorObject = JSON.parse(errorString);
1import { renderError } from "@visulima/error"; 2 3const error = new Error("This is an error message"); 4 5console.log(renderError(error)); 6 7// Error: This is an error message 8// 9// at <unknown> file:///home/visulima/visulima/examples/error/node/render-error.js:5 10// 1 | import { renderError } from "@visulima/error"; 11// 2 | 12// 3 | const error = new Error("This is an error message"); 13// 4 | 14// ❯ 5 | console.log(renderError(new Error("This is an error message"))); 15// | ^ 16// 6 | 17// 18// at ModuleJob.run node:internal/modules/esm/module_job:195 19// at async ModuleLoader.import node:internal/modules/esm/loader:336 20// at async loadESM node:internal/process/esm_loader:34 21// at async handleMainPromise node:internal/modules/run_main:106
Use the @visulima/colorize
, chalk
or some other package to colorize the output.
Type: AggregateError | Error | VisulimaError
The error to render.
Type: object
Type: object
The color options.
Type: string
The current working directory.
Type: boolean
Default: false
Display the short path.
Type: number
Default: Number.Infinity
The maximum number of frames to display.
Type: boolean
Default: false
Hide the error cause code view.
Type: boolean
Default: false
Hide the error code view.
Type: boolean
Default: false
Hide the error title.
Type: boolean
Default: false
Hide the error message.
Capture a raw stack trace.
1import { captureRawStackTrace } from "@visulima/error"; 2 3const stack = captureRawStackTrace(); 4 5console.log(stack);
Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
The visulima error is open-sourced software licensed under the [MIT][license-url]
[typescript-url]: https://www.typescriptlang.org/ "TypeScript" "typescript" [license-image]: https://img.shields.io/npm/l/@visulima/error?color=blueviolet&style=for-the-badge [license-url]: LICENSE.md "license" [npm-image]: https://img.shields.io/npm/v/@visulima/error/latest.svg?style=for-the-badge&logo=npm [npm-url]: https://www.npmjs.com/package/@visulima/error/v/latest "npm"
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
project has 4 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
license file detected
Details
Reason
30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
SAST tool detected: CodeQL
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Score
Last Scanned on 2025-07-08T07:32:37Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More