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

dwin-exception-tracker

v1.0.2

Published

Dwin Exception and Error Monitoring Agent SDK for Node.js applications.

Readme

dwin-exception-tracker

The Dwin Exception & Error Monitoring Agent SDK for Node.js.

Quickly capture unhandled runtime exceptions, HTTP request pipeline errors, and asynchronous promise rejections, sending detailed diagnostics and trace reports directly to your Dwin Dashboard.


Features

  • Zero Dependencies: Lightweight, native implementation utilizing standard modern APIs.
  • Express Middleware: Easy drop-in middleware for capturing all routing exceptions.
  • Dynamic Service Resolution: Automatically resolves target service names from options, environment variables (SERVICE_NAME), or defaults.
  • Manual Capture: Capture customized errors with rich context (e.g., custom endpoint name, sub-services).

Installation

From NPM Registry

npm install dwin-exception-tracker

From Local Source (For Testing/Development)

You can link the agent locally in your parent application:

npm install /path/to/dwin-api-monitor/agent

Quick Start

1. Initialize the SDK

Initialize the SDK at the top of your application's entrypoint (e.g., app.js or index.js).

const monitor = require('dwin-exception-tracker');

monitor.init({
  apiKey: 'your-dwin-agent-api-key', // Copy this from your Dwin settings panel
  serverUrl: 'http://localhost:3005', // Your Dwin monitoring dashboard backend URL
  service: 'payment-api'              // Dynamic name of this service
});

2. Manual Exception Capturing

Wrap logic blocks inside try/catch and capture any thrown exceptions:

try {
  // Application logic here...
  throw new Error('Database connection timeout');
} catch (err) {
  // Capture exception and send it to your Dwin console
  monitor.captureException(err, {
    endpoint: '/payments/process', // Optional request path context
    service: 'payment-api'         // Optional service override
  });

  throw err; // Re-throw if necessary
}

3. Express.js Integration

To automatically capture all unhandled errors thrown inside Express route handlers, register the Dwin middleware at the very end of your middleware stack, after all route definitions:

const express = require('express');
const monitor = require('dwin-exception-tracker');

const app = express();

// ... define your route handlers ...
app.get('/api/checkout', (req, res) => {
  throw new Error('Payment gateway refused connection');
});

// Register the Dwin Exception monitoring middleware
app.use(monitor.expressMiddleware());

// Optional: standard fallback error handler
app.use((err, req, res, next) => {
  res.status(500).json({ error: 'Internal Server Error' });
});

app.listen(3000, () => console.log('App running on port 3000'));

Configuration Options

Pass these options object parameters to monitor.init(options):

| Parameter | Type | Default | Description | | :--- | :--- | :--- | :--- | | apiKey | string | null | Required. The API Key copied from settings. | | serverUrl | string | 'http://localhost:3005' | Destination Dwin backend portal API url. | | service | string | 'node-application' | Name of the running service (falls back to process.env.SERVICE_NAME). |


How to Publish to NPM

To publish this agent package to the npm registry for public or private team distribution, execute these steps:

  1. Set Up an NPM Account: Sign up at npmjs.com.
  2. Log In via Terminal:
    npm login
  3. Publishing a Private Namespace (Scoped): If your package name matches @yourorg/agent, publish it as a scoped package:
    • For public scoped packages (visible to everyone):
      npm publish --access public
    • For private scoped packages (requires paid NPM plan):
      npm publish
  4. Publishing a Scoped/Unscoped Package: Inside /Users/apple/own/api-monitor/agent, run:
    npm publish