Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pagemon-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pagemon-sdk
pagemon-sdk
is a lightweight JavaScript SDK to monitor and report errors in your applications. Instantly capture unhandled errors, network issues, and manually report critical events to your configured integrations like Discord, Slack, Email, or Webhooks.
Installation
Install the SDK via npm:
npm install pagemon-sdk
Getting Started
Step 1: Create Your Project
Log in to your PageMon dashboard and create a new project. Add webhook URLs for Discord, Slack, or an email address for notifications. You can update these integrations later from your project settings.
Step 2: Get Your App ID
After creating your project, copy your unique App ID from the dashboard. This ID connects your application to PageMon.
Step 3: Automatic Error Monitoring
Use the monitor()
function to automatically capture unhandled errors:
import { monitor } from 'pagemon-sdk';
// Place this at the top of your entry file
monitor('YOUR_APP_ID');
// Your application code...
PageMon will now listen for errors and send detailed reports to your configured integrations.
Step 4: Manual Error Reporting
Use the notify()
function to manually report handled errors, e.g., within try...catch
blocks:
import { notify } from 'pagemon-sdk';
async function fetchUserData() {
try {
const response = await fetch('https://api.example.com/user');
if (!response.ok) throw new Error('Failed to fetch user data');
return await response.json();
} catch (error) {
notify('YOUR_APP_ID', error);
console.error('Could not fetch user data:', error);
return null;
}
}
This ensures you capture both automatic and manual errors for a complete view of your application's health.
Features
- Automatic error monitoring with
monitor()
- Manual error reporting with
notify()
- Multi-channel notifications (Discord, Slack, Email, Webhook)
- Easy integration with JavaScript applications
License
MIT License