
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
@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 Operational, 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 publishExports 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('Invalid Input', 'Describe what happened', 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', 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 45 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 breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.