Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
wrap-error-message
Advanced tools
Changelog
1.0.0
Initial release.
Readme
Properly wrap an error's message.
error.stack
with the
new error messageimport wrapErrorMessage from 'wrap-error-message'
wrapErrorMessage(new Error('Message.'), 'Additional message.')
// Error: Message.
// Additional message.
wrapErrorMessage(new Error('Message.'), 'Additional message:')
// Error: Additional message: Message.
wrapErrorMessage(new Error('Message.'), 'Additional message:\n')
// Error: Additional message:
// Message.
wrapErrorMessage(new Error('Message.'), '')
// Error: Message.
const invalidError = 'Message.'
wrapErrorMessage(invalidError, 'Additional message.')
// Error: Message.
// Additional message.
wrapErrorMessage(new Error(' Message with spaces '), ' Additional message ')
// Error: Message with spaces
// Additional message
npm install wrap-error-message
This package works in both Node.js >=14.18.0 and
browsers.
It is an ES module and must be loaded using
an import
or import()
statement,
not require()
.
error
Error | any
message
string
Return value: Error
Appends message
to error.message
. If message
ends with :
or :\n
,
prepends it instead.
Returns error
. If error
is not an Error
instance, it is converted to one.
modern-errors
: Handle errors
like it's 2022 🔮error-custom-class
: Create
one error classerror-class-utils
: Utilities
to properly create error classeserror-serializer
: Convert
errors to/from plain objectsnormalize-exception
:
Normalize exceptions/errorsis-error-instance
: Check if
a value is an Error
instancemerge-error-cause
: Merge an
error with its cause
set-error-class
: Properly
update an error's classset-error-message
: Properly
update an error's messageset-error-props
: Properly
update an error's propertiesset-error-stack
: Properly
update an error's stackerror-cause-polyfill
:
Polyfill error.cause
handle-cli-error
: 💣 Error
handler for CLI applications 💥log-process-errors
: Show
some ❤ to Node.js process errorsFor any question, don't hesitate to submit an issue on GitHub.
Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.
This project was made with ❤️. The simplest way to give back is by starring and sharing it online.
If the documentation is unclear or has a typo, please click on the page's Edit
button (pencil icon) and suggest a correction.
If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!
FAQs
Properly wrap an error's message
The npm package wrap-error-message receives a total of 5,741 weekly downloads. As such, wrap-error-message popularity was classified as popular.
We found that wrap-error-message demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.