Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@gtramontina.com/elysia-error-handler
Advanced tools
Elysia plugin to define HTTP error handlers in a more declarative way.
Elysia plugin to define HTTP error handlers in a more declarative way.
bun add --exact @gtramontina.com/elysia-error-handler
import { errorHandler } from "@gtramontina.com/elysia-error-handler";
import { Elysia } from "elysia";
class CustomForbiddenError extends Error { status = 403 }
new Elysia()
.use(
errorHandler({
400: () => new Response("too bad!", { status: 400 }), // return Response
403: () => 403, // return number
404: () => "uh-oh! not found!", // return string
500: ({ error }) => `error: ${error.message}`, // access to context
}),
)
.get("/400", () => { throw new ParseError(); })
.get("/403", () => { throw new CustomForbiddenError(); })
.get("/404", () => { throw new NotFoundError(); })
.get("/500", () => { throw new Error("boom!"); })
.listen(3000);
You can also import…
import { ErrorStatus } from "@gtramontina.com/elysia-error-handler";
…for more descriptive error status names, such as ErrorStatus.BadRequest
, ErrorStatus.TooManyRequests
, and so on.
FAQs
Elysia plugin to define HTTP error handlers in a more declarative way.
The npm package @gtramontina.com/elysia-error-handler receives a total of 28 weekly downloads. As such, @gtramontina.com/elysia-error-handler popularity was classified as not popular.
We found that @gtramontina.com/elysia-error-handler 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.