
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@amphibian/errors
Advanced tools
easily create meaningful errors
npm install @amphibian/errors
var errors = require('@amphibian/errors');
try {
throw errors.invalidInput('invalid_email_address', 'email', 't@hom.as');
} catch (error) {
console.log(error);
/*
{
[Error: Invalid Input (invalid_email_address): email t@hom.as]
status: 400,
type: 'invalid_input',
code: 'invalid_email_address',
data: ['email', 't@hom.as']
}
*/
}
var myError = errors.newError('My Error', {
status: 400,
type: 'my_error',
class: TypeError,
stack: true
});
try {
throw myError('my_error_code', 'Some description', 382763);
} catch (error) {
console.log(error);
/*
{
TypeError: My Error (my_error_code): Some description 382763
at [[... stack trace ...]]
status: 400,
type: 'my_error',
code: 'my_error_code',
data: ['Some description', 'Some more information here']
}
*/
}
notFound
: Not Found{status: 404, type: 'not_found'}
methodNotAllowed
: Method Not Allowed{status: 405, type: 'method_not_allowed'}
missingRequiredParameters
: Missing Required Parameters{status: 400, type: 'missing_required_parameters'}
invalidInput
: Invalid Input{status: 400, type: 'invalid_input'}
typeError
: Type Error{status: 400, type: 'type_error', class: TypeError}
unauthorized
: Unauthorized{status: 401, type: 'unauthorized'}
rateLimitExceeded
: Rate Limit Exceeded{status: 429, type: 'rate_limit_exceeded'}
fatalError
: Fatal Error{status: 500, type: 'fatal_error', stack: true}
FAQs
easily create meaningful errors
We found that @amphibian/errors demonstrated a not healthy version release cadence and project activity because the last version was released 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.