Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
subzero10 committed Oct 17, 2024
1 parent 8b3e706 commit 09f6a4f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/js/examples/chrome-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ In the <strong>Extensions</strong> page (`chrome://extensions`), click on the re
There are multiple ways to report an error, showcasing the different execution contexts in a chrome extension:
- An error is automatically reported from the background worker (`background.js`) as soon as it's loaded. This is how you know Honeybadger was loaded successfully in the worker.
- An error is automatically reported from the content script (`content.js`) as soon as it's loaded. This is how you know Honeybadger was loaded successfully in the content script.
- To report an error from the options page (`options.html` and `options.js`):
- To report an error from the options page (`options.html` and `options.js`) or the popup (`popup.html` and `popup.js`):
1. Open `error-reporting.js` and replace `YOUR_API_KEY` with your Honeybadger.js API key.
2. Make sure to reload the extension (see above).
3. Open the Options page and click on the Report Error button.
Or click on the extension icon to open the popup and click on the Report Error button.
4. Check your Honeybadger.js dashboard. The error should show up after a few seconds.
5 changes: 0 additions & 5 deletions packages/js/examples/chrome-extension/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ button.current {
box-shadow: 0 0 0 2px white,
0 0 0 4px black;
}

button#throwError {
width: 60px;
height: 50px;
}
2 changes: 1 addition & 1 deletion packages/js/examples/chrome-extension/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<button id="changeColor"></button>
<br/>
<br/>
<button id="throwError">Throw error</button>
<button id="reportErrorButton" style="width: auto">Report error!</button>
<script src="popup.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions packages/js/examples/chrome-extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function setPageBackgroundColor() {
}

// Button to throw an error and have it reported on Honeybadger
const throwError = document.getElementById('throwError');
throwError.addEventListener('click', async () => {
const reportErrorButton = document.getElementById('reportErrorButton');
reportErrorButton.addEventListener('click', async () => {
// eslint-disable-next-line no-undef
someUndefinedFunction();
});

0 comments on commit 09f6a4f

Please sign in to comment.