npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

youch-core

v0.3.3

Published

Error parser to parse an error instance into a collection of frames

Downloads

8,304,432

Readme

youch-core

Error parser to parse an error instance into a collection of frames

gh-workflow-image npm-image license-image

Introduction

The youch-core package contains the Error parser used by youch to pretty print Errors on the Web and the terminal.

It is a low-level package and you will only use it if you want to create your own Error printer while re-using the core Error parsing logic.

Installation

Install the package from the npm registry as follows.

npm i @poppinss/dumper
yarn add @poppinss/dumper
pnpm add @poppinss/dumper

Usage

You may parse an error using the ErrorParser.parse method. The parse method accepts the erorr object and returns back a Promise with ParsedError.

import { ErrorParser } from 'youch-core'

/**
 * Error object to parse
 */
const error = new Error('Something went wrong')

/**
 * Create parser instance and parse the error
 */
const parser = new ErrorParser()
const parsedError = await parser.parse(error)

The parsedError.frames property is an array of stack frames with the filename, line number and the source code snippet for the given frame in the stack.

parsedError.frames.forEach((frame) => {
  console.log(`${frame.type}: ${frame.fileName}:${frame.lineNumber}`)
})

Using a custom source code loader

The ErrorParser reads the source code of files within the stack trace using the Node.js fs module. However, you can override this default and provide a custom source loader using the parser.defineSourceLoader method.

[!NOTE] The defineSourceLoader method is called for every frame within the stack traces. Therefore, you must perform the necessary checks before attempting to read the source code of a file. For example, you must not attempt to read the source code for fileNames pointing to native code.

const parser = new ErrorParser()

parser.defineSourceLoader(async (stackFrame) => {
  if (stackFrame.type !== 'native') {
    stackFrame.source = await someFunctionToGetFileSource(stackFrame.fileName)
  }
})

Contributing

One of the primary goals of Poppinss is to have a vibrant community of users and contributors who believes in the principles of the framework.

We encourage you to read the contribution guide before contributing to the framework.

Code of Conduct

In order to ensure that the Poppinss community is welcoming to all, please review and abide by the Code of Conduct.

License

The youch-core package is open-sourced software licensed under the MIT license.