
Security News
Lovable’s OJ Rewrites Vite’s Dev Server in Rust as AI Lowers the Cost of Forking Open Source
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.
@ebec/http
Advanced tools
This library provides HTTP base error classes (NotFoundError, InternalServerError, ...),
which can simply be extended.
Table of Contents
npm install @ebec/http --save
The usage is pretty easy, just import one of the client or server error classes and use them
in throw- & catch- statements.
Basic
import {
InternalServerError,
NotFoundError
} from "@ebec/http";
const clientError = new NotFoundError();
console.log(clientError.getOption('statusCode'));
// 404
console.log(clientError.getOption('logMessage'));
// false
console.log(clientError.getOption('code'));
// NOT_FOUND
// ------------------------------------
const serverError = new InternalServerError({
logLevel: 'warning'
});
console.log(serverError.getOption('statusCode'));
// 500
console.log(serverError.getOption('logMessage'));
// true
console.log(serverError.getOption('code'));
// INTERNAL_SERVER_ERROR
console.log(serverError.getOption('logLevel'));
// warning
Another way to use the predefined error classes is to extend them,
with own options.
Extend
import {
Options,
mergeOptions,
NotFoundError
} from "@ebec/http";
class UserNotFound extends NotFoundError {
constructor(options?: Options) {
super(mergeOptions(
{
message: 'The user was not found.',
code: 'USER_NOT_FOUND'
},
...(options ? options : {})
));
}
}
The following HTTP classes are predefined:
BadRequestErrorUnauthorizedErrorForbiddenErrorNotFoundErrorMethodNotAllowedErrorNotAcceptableErrorProxyAuthenticationRequiredErrorRequesTimeoutErrorConflictErrorGoneErrorLengthRequiredErrorPreconditionFailedErrorRequestEntityTooLargeErrorRequestUriTooLongErrorUnsupportedMediaTypeErrorRequestRangeNotSatisfiedErrorExpectationFailedErrorImATeapotErrorEnhanceYourCalmErrorUnprocessableEntityErrorLockedErrorFailedDependencyErrorUnorderedCollectionErrorUpgradeRequiredErrorPreconditionRequiredErrorTooManyRequestErrorRequestHeaderFieldsTooLargeErrorNoResponseErrorRetryWithErrorBlockedByWindowsParentErrorClientClosedRequestErrorInternalServerErrorNotImplementedErrorBadGatewayErrorServiceUnavailableErrorGatewayTimeoutErrorHTTPVersionNotSupportedErrorVariantAlsoNegotiatesInsufficientStorageErrorLoopDetectedErrorBandwidthLimitExceededErrorNotExtendedErrorNetworkAuthenticationRequiredErrorMade with 💚
Published under MIT License.
FAQs
43 pre-built HTTP error classes (4xx/5xx) with status codes, status messages, and duck-typed type guards.
The npm package @ebec/http receives a total of 480 weekly downloads. As such, @ebec/http popularity was classified as not popular.
We found that @ebec/http 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.

Security News
Lovable’s OJ rewrites Vite’s dev server in Rust, reducing memory use and preview times as AI lowers the cost of open source reimplementation.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.