1.0.3 • Published 6 months ago
@breadth.cloud/client v1.0.3
Breadth Client
JavaScript error tracking client for Breadth.cloud.
Installation
npm install @breadth.cloud/client
# or
yarn add @breadth.cloud/client
# or
pnpm add @breadth.cloud/clientUsage
Quick Setup
You can use our setup script to quickly configure Breadth in your project:
# After installing the package
npx breadth-setupThis interactive script will: 1. Ask for your API key 2. Let you select your project type 3. Create a configuration file with the proper setup 4. Provide next steps for integration
Manual Setup
import Breadth from '@breadth.cloud/client';
// Initialize with your API key
const errorTracker = new Breadth({
apiKey: 'your-api-key'
});
// That's it! Errors will be automatically capturedAdvanced Configuration
import Breadth from '@breadth.cloud/client';
// Initialize with custom configuration
const errorTracker = new Breadth({
apiKey: 'your-api-key',
apiUrl: 'https://your-custom-breadth-instance.com' // Optional: custom API endpoint
});Manual Error Tracking
In addition to automatic error capturing, you can manually track errors:
try {
// Your code that might throw an error
riskyOperation();
} catch (error) {
// Manually track the caught error
errorTracker.trackError(error);
}
// You can also track custom error messages
errorTracker.trackError('Something went wrong with the payment process');Features
- Automatic capture of uncaught exceptions
- Unhandled promise rejection tracking
- Anonymous client identification
- Minimal performance impact
- TypeScript support
- Works in both browser and Node.js environments (with appropriate polyfills)
Configuration Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| apiKey | string | Yes | - | Your Breadth.cloud API key |
| apiUrl | string | No | https://api.breadth.cloud | Custom API endpoint URL |
Browser Support
- Chrome 60+
- Firefox 55+
- Safari 11+
- Edge 79+
- Opera 47+
- iOS Safari 11+
- Android Browser 76+
Local Development
For instructions on how to use this package during local development, see LOCAL_DEVELOPMENT.md.
License
MIT