Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
plugin-error
Advanced tools
The plugin-error npm package is designed to simplify error handling in plugin development, particularly for Gulp plugins. It provides a consistent way to create and manage errors, making it easier to debug and handle errors in a standardized manner.
Creating a PluginError
This feature allows you to create a new PluginError instance. The first argument is the plugin name, and the second argument is the error message. This helps in identifying which plugin caused the error.
const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', 'Something went wrong!');
console.error(err.toString());
Handling Error Options
This feature allows you to pass an options object to the PluginError constructor. The options can include properties like 'message' and 'showStack' to customize the error output.
const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', {
message: 'Something went wrong!',
showStack: true
});
console.error(err.toString());
Using Error Codes
This feature allows you to specify an error code, which can be useful for programmatically identifying different types of errors.
const PluginError = require('plugin-error');
const err = new PluginError('MyPlugin', {
message: 'Something went wrong!',
code: 'EPLUGIN'
});
console.error(err.toString());
The fancy-log package is used for logging messages in a more readable format. While it doesn't specifically handle errors, it can be used alongside plugin-error to log error messages in a more user-friendly way.
The gulplog package is a logging utility specifically designed for Gulp. It provides a way to log messages at different levels (info, warn, error). While it doesn't create error objects like plugin-error, it can be used to log errors created by plugin-error.
The chalk package is used for styling terminal string output. It can be used in conjunction with plugin-error to colorize error messages, making them easier to read and debug.
Error handling for Vinyl plugins.
var PluginError = require('plugin-error');
var err = new PluginError('test', {
message: 'something broke'
});
var err = new PluginError({
plugin: 'test',
message: 'something broke'
});
var err = new PluginError('test', 'something broke');
var err = new PluginError('test', 'something broke', { showStack: true });
var existingError = new Error('OMG');
var err = new PluginError('test', existingError, { showStack: true });
new PluginError(pluginName, message[, options])
Error constructor that takes:
pluginName
- a String
that should be the module name of your pluginmessage
- a String
message or an existing Error
objectoptions
- an Object
of your optionsBehavior:
options.showStack
to true if you think the stack is important for your error.err.toString()
, but may be omitted by including { showProperties: false }
in the options.MIT
2.0.0 (2022-07-01)
FAQs
Error handling for Vinyl plugins.
The npm package plugin-error receives a total of 1,262,174 weekly downloads. As such, plugin-error popularity was classified as popular.
We found that plugin-error demonstrated a not healthy version release cadence and project activity because the last version was released 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.