Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@adonisjs/generic-exceptions
Advanced tools
List of generic exceptions to be used in all other repos
Customized exceptions for AdonisJs
This repo contains some helpful classes to throw uniform exceptions through out the application. Ofcourse you can throw exceptions using new Error()
but using this package will help in throwing informative exceptions.
Install package using npm.
npm i @adonisjs/generic-exceptions
The package exports all exceptions from node-exceptions and adds additional methods to the RuntimeException
class.
const { InvalidArgumentException } = require('@adonisjs/generic-exceptions')
const message = 'Model.create requires an object'
const status = 400
const code = 'E_INVALID_ARGUMENT'
throw new InvalidArgumentException(message, status, code)
The status
must be a valid HTTP status code and code
is a unique error code to recognize an exception. AdonisJs error codes starts with E_
, for example: E_MISSING_CONFIG
.
The following static methods are added to the runtime exception to make the adonisJs related exceptions consistent.
Checkout the complete API docs here
FAQs
List of generic exceptions to be used in all other repos
We found that @adonisjs/generic-exceptions 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.