@appsignal/plugin-path-decorator v1.0.16
AppSignal for JavaScript
Description
Usage
First, make sure you've installed AppSignal in your application by following the steps in Installation.
Track any error
Catch an error and report it to AppSignal:
try {
// do something that might throw an error
} catch (error) {
appsignal.sendError(error)
// handle the error
}
// You can catch errors asynchronously by listening to Promises...
asyncActionThatReturnsAPromise().catch(error => appsignal.sendError(error))
// ...or by using async/await
async function() {
try {
const result = await asyncActionThatReturnsAPromise()
} catch (error) {
appsignal.sendError(error)
// handle the error
}
}
// ...or in an event handler or callback function
events.on("event", (err) => {
appsignal.sendError(err)
})
NOTE: Uncaught exceptions are not captured by default. We made the decision to not include this functionality as part of the core library due to the high amount of noise from browser extensions, ad blockers etc. that generally makes libraries such as this less effective.
We recommend using a relevant integration as a better way to handle exceptions, or, if you would prefer capture uncaught exceptions, you can do so by using the @appsignal/plugin-window-events
package alongside this one.
Installation
First, sign up for an AppSignal account and add the @appsignal/javascript
package to your package.json
. Then, run yarn install
/npm install
.
You can also add these packages to your package.json
on the command line:
yarn add @appsignal/javascript
npm install --save @appsignal/javascript
You can then import and use the package in your bundle:
import Appsignal from "@appsignal/javascript" // For ES Module
const Appsignal = require("@appsignal/javascript").default // For CommonJS module
const appsignal = new Appsignal({
key: "YOUR FRONTEND API KEY"
})
It's recommended (although not necessarily required) to use the instance of the Appsignal
object like a singleton. One way that you can do this is by export
ing an instance of the library from a .js
/.ts
file somewhere in your project.
import Appsignal from "@appsignal/javascript"
export default new Appsignal({
key: "YOUR FRONTEND API KEY"
})
Currently, we have no plans to supply a CDN-hosted version of this library.
If you're stuck, feel free to contact us for help!
Development
Installation
This repository is a Lerna-managed monorepo, containing packages (located in the /packages
directory) that map to separate npm
modules.
To install the dependencies:
yarn install
lerna bootstrap
You can then run the following to start the compiler in watch mode. This automatically compiles both the ES Module and CommonJS variants:
yarn build:watch
You can also build the library without watching the directory:
yarn build # build both CJS and ESM
yarn build:cjs # just CJS
yarn build:esm # just ESM
Testing
The tests for this library use Jest as the test runner. Once you've installed the dependencies, you can run the following command in the root of this repository to run the tests for all packages, or in the directory of a package to run only the tests pertaining to that package:
yarn test
Versioning
This repo uses Semantic Versioning (often referred to as semver). Each package in the repository is versioned independently from one another.
@TODO: define how this works once we know more about releasing
Contributing
Thinking of contributing to this repo? Awesome! 🚀
Please follow our Contributing guide in our documentation and follow our Code of Conduct.
Also, we would be very happy to send you Stroopwafles. Have look at everyone we send a package to so far on our Stroopwafles page.
Support
Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.
Also see our SUPPORT.md file.
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago