
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@firstfleet/fferrorhandler
Advanced tools
A centralized error handler. Uses a custom error object so we not only get the stack trace but we can also track attributes the tie into papertrails log aggregation. Those attributes we are using are, sender, program, message, severity. We also set a custom attribute called isOperational. This denotes if an error is an operational error or a programmer error.
The error handler also handles all uncaughtException, and unhandledRejection. On uncaughtException if the error is Programmer, the process is restarted after the error is logged.
If you update the js docs you can rebuild them by running
npm run build-docs
To publish to npm
npm loginnpm run sendExports a custom error type AppError. Can be flagged as a programmer error or an operational error. All errors should be capture, when you want to throw an error, import the module
const { AppError } = require('...pathToErrorModule/errorHandler');
Then throw the custom error. The custom error takes in a sender, program, message, severity and a boolean for isOperational
throw new AppError('Node1', 'ffmobileNode2', 'api call failed', errorLevels.COMMON, true);
There is also a built in error handler. You can import it
const { handleError, errorLevels } = require('...pathToErrorModule/errorHandler');
Then call it when you want to handle an error. Error levels can be imported from the errorType file. The error handler is async so it will finish logging before process.exit calls. Handle error returns a promise so you can handle async errors and compose.
handlerError(sender, program, message, severity, isOperational);
handleError('Node1', 'ffmobileNode2', 'totally broke the input box by adding script tags', errorLevels.COMMON, true);
The error handler will transform the error into our custom AppErro type, send it to papertrail, and console log it if the process.ENV !== 'production'
Programmer errors refer to cases where you have no idea why and sometimes where an error came from – it might be some code that tried to read an undefined value or DB connection pool that leaks memory.
Operational errors refer to situations where you understand what happened and the impact of it – for example, a query to some HTTP service failed due to connection problem.
FAQs
handle errors
The npm package @firstfleet/fferrorhandler receives a total of 15 weekly downloads. As such, @firstfleet/fferrorhandler popularity was classified as not popular.
We found that @firstfleet/fferrorhandler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.