
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sendable-error
Advanced tools
Composable errors to simplify creating useful failure responses for APIs
Composable errors to simplify creating useful failure responses for APIs
SendableErrors provide built-in support for:
import { SendableError } from "sendable-error";
try {
throw new SendableError({
status: 400,
code: "validation/missing-required",
message: "Missing required field 'id'",
public: true,
details: {
field: "id"
}
})
} catch (error) {
return SendableError.of(error).toResponse();
}
Response with status code 400:
{
"code": "validation/missing-required",
"message": "Missing required field 'id'",
"traceId": "8ab9c56a-90d1-5e71-b67a-d6b725837802",
"details": {
"field": "id"
}
}
npm i sendable-error
Creating a new error from scratch:
throw new SendableError({
code: CODE_MISSING_REQUIRED,
message: "Missing required field 'id'",
public: true,
details: {
field: "id",
},
});
Or provide a cause for the error:
throw new SendableError({
code: CODE_DATABASE_ERROR,
cause: error,
});
Or even transform an error from elsewhere into a SendableError:
throw SendableError.of(error, {
code: CODE_DATABASE_ERROR
});
app.use((error, req, res, next) => {
SendableError.of(error).send(res);
});
export const handler = async (request: Request) => {
try {
// do something that might throw
} catch (error) {
return SendableError.of(error).toResponse();
}
}
try {
// do something that might throw
} catch (error) {
const responseBody = SendableError.of(error).toResponseBody();
/* send responseBody */
}
FAQs
Composable errors to simplify creating useful failure responses for APIs
The npm package sendable-error receives a total of 170 weekly downloads. As such, sendable-error popularity was classified as not popular.
We found that sendable-error 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.