
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.
discord-error
Advanced tools
Creates a JavaScript Error from the body response of a Discord API JSON error message
Creates a JavaScript Error from the body response of a Discord API JSON error message. It is intended to be used primarily in libraries rather than client code.
import { DiscordError, isDiscordError } from "discord-error";
// This should be the incoming interaction request
const request = new Request();
// A request to the Discord API that performs some action
const response = await fetch(DISCORD_API, { ...options });
if (!response.ok) {
const data = await response.json();
const label = isDiscordError(data) ? data.code : data.error;
throw new DiscordError(request, response, label, data);
}
This code is derived from code originally written by the discord.js maintainers in the @discordjs/rest package and distributed under the Apache 2 license. It was changed to be built with Web APIs instead of Node.js APIs.
FAQs
Creates a JavaScript Error from the body response of a Discord API JSON error message
We found that discord-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.

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.