Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
@snapshot-labs/snapshot-sentry
Advanced tools
`snapshot-sentry` is an npm package that contains the Sentry setup files and configurations for Snapshot backend projects. It simplifies the process of setting up Sentry for error tracking in any Snapshot service.
Readme
snapshot-sentry
is an npm package that contains the Sentry setup files and configurations for Snapshot backend projects.
It simplifies the process of setting up Sentry for error tracking in any Snapshot service.
yarn add @snapshot-labs/snapshot-sentry
Set the following env variables:
SENTRY_DSN
(required)SENTRY_TRACE_SAMPLE_RATE
(Optional, default to 0.01
)Import the library in your root file
import { initLogger, fallbackLogger } from '@snapshot-labs/snapshot-sentry'
Init sentry just after creating your express instance, before any middleware
const app = express();
initLogger(app);
Set the fallthrough error handler after all controllers, but before any other error middleware
fallbackLogger(app);
Note: If you have a catch-all route, set fallbackLogger()
before it.
All uncaught errors, with code >= 500, will be handled automatically by Sentry. See Capture exception for how to handle caught exceptions.
Import the library in your root file
import { initLogger } from '@snapshot-labs/snapshot-sentry'
Init sentry, as soon as possible to catch all errors.
initLogger()
See Capture exception for how to handle exceptions.
To capture an exception, use the capture
function:
import { capture } from '@snapshot-labs/snapshot-sentry'
try {
throw new Error('Ooops, someting went wrong');
} catch (e: any) {
// Send the error to sentry
capture(e)
}
You can also pass additional context data to the capture function:
import { capture } from '@snapshot-labs/snapshot-sentry'
let url = '';
try {
url = getUrlFromSomewhere('argOne')
throw new Error('Ooops, someting went wrong');
} catch (e: any) {
// Send the error to sentry
capture(e, { context: { url: url }})
}
When sentry is disabled, the capture
function will fallback to a simple console.log
, so no code change will be required when toggling this library on/off.
Snapshot-sentry is open-sourced software licensed under the © MIT license.
FAQs
`snapshot-sentry` is an npm package that contains the Sentry setup files and configurations for Snapshot backend projects. It simplifies the process of setting up Sentry for error tracking in any Snapshot service.
The npm package @snapshot-labs/snapshot-sentry receives a total of 395 weekly downloads. As such, @snapshot-labs/snapshot-sentry popularity was classified as not popular.
We found that @snapshot-labs/snapshot-sentry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.