https://github.com/bugsplat-git/my-javascript-crasher
Crush your JavaScript bugs by following the example in this repo
https://github.com/bugsplat-git/my-javascript-crasher
browser bugsplat error esmodules javascript js reporting web
Last synced: 3 months ago
JSON representation
Crush your JavaScript bugs by following the example in this repo
- Host: GitHub
- URL: https://github.com/bugsplat-git/my-javascript-crasher
- Owner: BugSplat-Git
- Created: 2017-08-25T17:01:46.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T00:23:47.000Z (6 months ago)
- Last Synced: 2024-12-06T01:24:16.584Z (6 months ago)
- Topics: browser, bugsplat, error, esmodules, javascript, js, reporting, web
- Language: HTML
- Homepage: https://docs.bugsplat.com/introduction/getting-started/integrations/web/javascript
- Size: 333 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://bugsplat.com)
#BugSplat
### **Crash and error reporting built for web developers.**
# my-javascript-crasher
This sample project demonstrates how to use the [bugsplat](https://github.com/BugSplat-Git/bugsplat-js) package to report JavaScript errors in web applications. Before continuing with the tutorial please make sure you have completed the following checklist:
* [Sign Up](https://app.bugsplat.com/v2/sign-up) as a new BugSplat user.
* [Log In](https://app.bugsplat.com/cognito/login) using your email address.## โ๏ธ Integrating
Import [bugsplat](https://github.com/BugSplat-Git/bugsplat-js) from [esm.sh](https://esm.sh)
```html
import { BugSplat } from 'https://esm.sh/[email protected]';
```
Create a new instance of BugSplat with your database, application, and version
```javascript
const bugsplat = new BugSplat('fred', 'my-javascript-crasher', '1.0.0');
```Configure bugsplat to listen to `window.onerror` and `window.onunhandledrejection` events
```javascript
window.onerror = function (message, source, lineno, colno, error) {
bugsplat.post(error);
};window.addEventListener('unhandledrejection', function (event) {
bugsplat.post(event.reason);
});
```Trigger an error to see it reported in BugSplat
```javascript
throw new Error('todo bg');
```## ๐งช Sample
Clone the [my-javascript-crasher](https://github.com/BugSplat-Git/my-javascript-crasher) repository
```sh
git clone https://github.com/BugSplat-Git/my-javascript-crasher
```Install the dependencies
```sh
cd my-javascript-crasher
npm i
```Start the server
```sh
npm start
```Open your browser and navigate to [http://localhost:8080](http://localhost:8080), then click the button to trigger an error.
## ๐ Viewing Reports
Navigate to the BugSplat [Crashes](https://app.bugsplat.com/v2/crashes?database=Fred&c0=appName&f0=CONTAINS&v0=my-javascript-crasher) page to view your report.

Click on the ID of the most recent error to view the details of your report.
