Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
mobx-state-tree-action-catch
Advanced tools
Error catcher middleware for mobx state tree.
Created with reference to redux-catch
$ npm i mobx-state-tree-action-catch
# or
$ yarn add mobx-state-tree-action-catch
import actionCatch from 'mobx-state-tree-action-catch';
function errorHandler(error, snapshot: ReturnType<typeof getSnapshot>, lastAction: string) {
console.error(error);
console.error(snapshot)
console.error(lastAction)
}
const Store = types.model({
UIStore: types.optional(UIStore, {}),
})
export interface IStore extends Instance<typeof Store> {}
const createStore = (snapshot = null): IStore => {
MobxStore = Store.create()
if (snapshot) {
applySnapshot(MobxStore, snapshot)
}
// Add actionCatch to middleware
addMiddleware(MobxStore, actionCatch(errorHandler))
return MobxStore
}
export default createStore
To use it with Sentry just download the Sentry script from npm:
npm i -S raven-js raven
Now load and configure your client:
import Raven from 'raven-js';
const sentryKey = '<key>';
Raven
.config(`https://${sentryKey}@app.getsentry.com/<project>`)
.install();
And then use Raven.captureException as the error handler like this:
const createStore = (snapshot = null): IStore => {
MobxStore = Store.create()
if (snapshot) {
applySnapshot(MobxStore, snapshot)
}
// Add actionCatch to middleware
addMiddleware(MobxStore, actionCatch((error) => Raven.captureException(error), MobxStore))
return MobxStore
}
FAQs
Error catcher middleware for mobx state tree
The npm package mobx-state-tree-action-catch receives a total of 1 weekly downloads. As such, mobx-state-tree-action-catch popularity was classified as not popular.
We found that mobx-state-tree-action-catch 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.