
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
inra-server-error
Advanced tools
[](https://www.npmjs.com/package/inra-server-error) [](https://david-dm.org/pro
A simple, yet powerful error handler shipped as a middleware for Koa.
inra-server-error
provides a set of utilities for defining and returning HTTP errors. Each utility returns an error response object which includes the following properties:
{
"success": "…",
"errorCode": "…",
"userMessage": "…",
"developerMessage": "…"
}
Note: full documentation with more examples is published on our Wiki. Please, refer to our Wiki for installation details and API references.
$ npm install --save inra-server-error
import error, {defineError} from "inra-server-error";
error(options)
Koa errors middleware which catches exceptions thrown inside other middlewares or routes and generates a graceful response.
Example:
app.use(error({
errorCode: "Default error code"
httpStatus: "Default HTTP status",
userMessage: "Default user message",
callback(error) {
// Will be executed on each exception
}
}));
defineError(definition)
Defines an error handler for a specified exception type.
Note: to make our middleware handle custom errors, you must define an error with exception's instance. Other fields are optional.
Example:
defineError({
instance: AuthWrongUsernameError,
errorCode: "Optional error code"
httpStatus: "Optional HTTP status",
userMessage: "Optional user message",
callback(error) {
// …
}
});
class CustomError extends Error {
errorCode = 103;
httpStatus = 401;
userMessage = "Something went wrong";
};
defineError({
instance: CustomError
});
We want contributing to Inra Server to be fun, enjoyable, and educational for anyone, and everyone. Changes and improvements are more than welcome! Feel free to fork and open a pull request. If you have found any issues, please report them here - they are being tracked on GitHub Issues.
We have prepared multiple commands to help you develop inra-server-error
on your own. Don't forget to install all Node.js
dependencies from npm. You will need a local copy of Node.js installed on your machine.
$ npm install
$ npm run <command>
Command | Description |
---|---|
build | Builds inra-server-error |
watch | Re-builds inra-server-error on changes |
clean | Deletes builds ands cache |
lint | Fixes Lint errors |
flow | Checks Flow errors |
test | Checks Flow errors and runs tests |
FAQs
[](https://www.npmjs.com/package/inra-server-error) [](https://david-dm.org/pro
We found that inra-server-error 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.