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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@netkitty/errors

v1.2.0

Published

Shared error primitives for the netkitty packages — the NetKittyError base class every package's errors extend, plus a central error-code registry. Pure JS, zero dependencies, browser-safe.

Readme

@netkitty/errors

netkitty 各子包共享的错误基元:每个子包的 error 都继承的 NetKittyError 基类,以及一份集中的 ErrorCode 错误码表。纯 JS、零依赖、浏览器可跑。

English docs: README.md

安装

npm i @netkitty/errors

为什么需要它

每个 netkitty 子包抛出的 error 都继承 NetKittyError,因此使用者可以统一识别任何一个 netkitty 错误—— 不管它是哪个子包抛的——并按它的 code/errno 分支处理:

import {NetKittyError} from '@netkitty/errors'

try {
  await codec.encode(input)
} catch (e) {
  if (e instanceof NetKittyError) {
    console.error(e.name, e.code, e.errno, e.message)
    // 例如 "CodecSchemaValidateError" "E_CODEC_SCHEMA_VALIDATE" 2001 "..."
  }
}

API

NetKittyError extends Error implements NodeJS.ErrnoException —— 带一个 errno: numbercode: string, 并把 name 设为具体子类名。定义一个子包 error 时继承它即可:

import {NetKittyError, ErrorCode} from '@netkitty/errors'

export class DeviceNotFoundError extends NetKittyError {
  public errno: number = ErrorCode.E_DEVICE_NOT_FOUND.errno
  public code: string = ErrorCode.E_DEVICE_NOT_FOUND.code
}

ErrorCode —— 集中的错误码表,把每个 errno 和一个稳定的 code 配对,按子包分段(1000 段 = capture, 2000 段 = codec,……),从而无论来自哪个包,一个 code 都是全局唯一的。