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.
@smarterservices/error-response
Advanced tools
Readme
This module is used to format the error and send user defined error in response.
terminal
in your project root directory
.npm install
to install necessary dependencies.config/errors
subdirectory, list errors in defined-erros.json
in following structure{
"JOI": {
"ERROR_NAME": {
"code": "4000",
"message": "Joi related error message"
}
},
"ERROR_NAME": {
"code": "6000",
"message": "The error message to attach"
}
}
All joi related errors will be listed under JOI
object and other general errors will be listed as shown in the structure.
config
subdirectory and modify the following things in configuration file (i.e default.json
).
url
to attach additional url in ResponseprintError
to true if you want to print error from moduleFor example, your configuration may look like as follows:
{
"errorResponse": {
"url": "https://www.smarterservices.com/errors/",
"printError": false
}
}
formatError
to format the errorconst errorResponse = require('error-response');
const options = {
values: {
approvalSid: 'AP...',
installSid: 'AI...'
}
};
const error = errorResponse.formatError('APPROVAL_NOT_FOUND_UNDER_INSTALL', options);
To generate the above error, the error object should be as follows
{
"APPROVAL_NOT_FOUND_UNDER_INSTALL": {
"code": "6001",
"message": "approval '%approvalSid%' not found under '%installSid%'",
"status": 404
}
}
approvalSid
will be replaced by the given in options
object.statusCode
is 400, passing status in error object will override the default statusCode
.errorResponse.failAction
to wrap joi
related error.n/a
n/a
n/a
FAQs
This is a module to format error
The npm package @smarterservices/error-response receives a total of 1 weekly downloads. As such, @smarterservices/error-response popularity was classified as not popular.
We found that @smarterservices/error-response demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
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.