Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
babel-plugin-catch-logger
Advanced tools
A babel plugin that automatically reports errors in your program
A babel plugin that:
.catch()
function call.name: string
- The name of the your logging service.source: string
- The import path name of your logging service.methodName: string
- Which logging method to invoke.catchPromise: boolean
- Whether to catch promises.namespaced: boolean
- Whether to import the logging service as a namespace module..babelrc.json
{
"plugins": [
[
"babel-plugin-catch-logger",
{
"name": "Sentry",
"source": "@sentry/node",
"methodName": "captureException",
"catchPromise": true,
"namespaced": true
}
]
]
}
src/foo.js
export function noop() {
try {
return nonexistent
} catch (ignore) {
// console.log(ignore);
}
}
export function bar() {
return fetch('https://google.com').json().then(console.log)
}
export function baz() {
return fetch('https://google.com')
.json()
.then(console.log)
.catch((e) => {
console.error(e)
})
}
gets compiled to:
import * as Sentry from '@sentry/node'
export function noop() {
try {
return nonexistent
} catch (ignore) {
// console.log(ignore);
Sentry.captureException(ignore)
}
}
export function bar() {
return fetch('https://google.com')
.json()
.then(console.log)
.catch(function (_e) {
Sentry.captureException(_e)
})
}
export function baz() {
return fetch('https://google.com')
.json()
.then(console.log)
.catch((e) => {
Sentry.captureException(e)
console.error(e)
})
}
src/bar.js
fetch().json().then(console.log)
gets compiled to:
import * as Sentry from '@sentry/node'
fetch()
.json()
.then(console.log)
.catch(function (_e) {
Sentry.captureException(_e)
})
FAQs
A babel plugin that automatically reports errors in your program
The npm package babel-plugin-catch-logger receives a total of 155 weekly downloads. As such, babel-plugin-catch-logger popularity was classified as not popular.
We found that babel-plugin-catch-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.