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

sentry-sdk-learning

v1.0.5

Published

A custom Sentry SDK for learning

Readme

Sentry SDK Learning

A lightweight, custom-built Sentry SDK for learning purposes. This library demonstrates the core concepts of error tracking, including automatic error capture, DSN parsing, and event transport.

npm version License: MIT

🚀 Features

  • Automatic Error Capture: Catches uncaught exceptions (window.onerror)
  • Promise Rejection Handling: Catches unhandled Promise rejections
  • Manual Capture: Report handled errors with captureException
  • Smart DSN Parsing: Automatically extracts project ID and auth keys
  • Stack Trace Parsing: Formats stack traces for Sentry dashboard
  • Zero Dependencies: Built from scratch with vanilla JavaScript

📦 Installation

Install the package via npm:

npm install sentry-sdk-learning

🛠 Usage

1. Initialize the SDK

Option A: Using the Provider (Recommended for React)

Wrap your application with SentryProvider. This handles initialization AND automatically catches render errors in your component tree.

import { SentryProvider } from 'sentry-sdk-learning';

function App() {
  return (
    <SentryProvider config={{
      dsn: 'YOUR_SENTRY_DSN_HERE',
      environment: 'production',
      release: 'v1.0.0'
    }}>
      <YourApp />
    </SentryProvider>
  );
}

Option B: Manual Initialization

Import and initialize the SDK at the entry point of your application (e.g., main.jsx, App.js, or index.js).

import Sentry from 'sentry-sdk-learning';

Sentry.init({
  dsn: 'YOUR_SENTRY_DSN_HERE',
  environment: 'production', // optional (default: production)
  release: 'v1.0.0'          // optional (default: unknown)
});

2. Manual Error Capture

You can manually report errors that are caught in try-catch blocks:

try {
  // Your risky code
  throw new Error("Something went wrong!");
} catch (error) {
  Sentry.captureException(error);
}

3. Automatic Capture

The SDK automatically listens for:

  • Uncaught JavaScript errors
  • Unhandled Promise rejections

No extra code is needed! Just initialize the SDK, and it will watch over your app.

📖 API Reference

init(options)

Initializes the SDK. Must be called before using other methods.

| Option | Type | Required | Description | |--------|------|----------|-------------| | dsn | string | Yes | Your Sentry DSN URL | | environment | string | No | Environment name (e.g., 'dev', 'prod') | | release | string | No | Application version string | | beforeSend | function | No | Hook to modify event before sending |

captureException(error)

Manually captures an error object and sends it to Sentry.

| Parameter | Type | Description | |-----------|------|-------------| | error | Error | The error object to capture |

🤝 Contributing

This project is for educational purposes. Feel free to fork it and experiment!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.