New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@adonisjs/http-server

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/http-server - npm Package Compare versions

Comparing version 6.8.2-11 to 6.8.2-12

47

build/src/exception_handler.d.ts

@@ -0,1 +1,2 @@

import Macroable from '@poppinss/macroable';
import type { Level } from '@adonisjs/logger/types';

@@ -16,3 +17,3 @@ import type { HttpContext } from './http_context/main.js';

*/
export declare class ExceptionHandler {
export declare class ExceptionHandler extends Macroable {
#private;

@@ -58,13 +59,27 @@ /**

/**
* Returns the log level for an error based upon the error
* status code.
*/
protected getErrorLogLevel(error: HttpError): Level;
/**
* A boolean to control if errors should be rendered with
* all the available debugging info.
*/
protected isDebuggingEnabled(_: HttpContext): boolean;
/**
* Returns a boolean by checking if an error should be reported.
*/
protected shouldReport(error: HttpError): boolean;
/**
* Renders an error to JSON response
*/
protected renderErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
renderErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Renders an error to JSON API response
*/
protected renderErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
renderErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Renders an error to HTML response
*/
protected renderErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
renderErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
/**

@@ -74,3 +89,3 @@ * Renders the validation error message to a JSON

*/
protected renderValidationErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
renderValidationErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
/**

@@ -80,30 +95,16 @@ * Renders the validation error message as per JSON API

*/
protected renderValidationErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
renderValidationErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Renders the validation error as an HTML string
*/
protected renderValidationErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
renderValidationErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Renders the error to response
*/
protected renderError(error: HttpError, ctx: HttpContext): Promise<void>;
renderError(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Renders the validation error to response
*/
protected renderValidationError(error: HttpError, ctx: HttpContext): Promise<void>;
renderValidationError(error: HttpError, ctx: HttpContext): Promise<void>;
/**
* Returns the log level for an error based upon the error
* status code.
*/
protected getErrorLogLevel(error: HttpError): Level;
/**
* A boolean to control if errors should be rendered with
* all the available debugging info.
*/
protected isDebuggingEnabled(_: HttpContext): boolean;
/**
* Returns a boolean by checking if an error should be reported.
*/
protected shouldReport(error: HttpError): boolean;
/**
* Reports an error during an HTTP request

@@ -110,0 +111,0 @@ */

@@ -10,2 +10,3 @@ /*

import is from '@sindresorhus/is';
import Macroable from '@poppinss/macroable';
import { parseRange } from './helpers.js';

@@ -25,3 +26,3 @@ import * as errors from './exceptions.js';

*/
export class ExceptionHandler {
export class ExceptionHandler extends Macroable {
/**

@@ -105,2 +106,40 @@ * Computed from the status pages property

/**
* Returns the log level for an error based upon the error
* status code.
*/
getErrorLogLevel(error) {
if (error.status >= 500) {
return 'error';
}
if (error.status >= 400) {
return 'warn';
}
return 'info';
}
/**
* A boolean to control if errors should be rendered with
* all the available debugging info.
*/
isDebuggingEnabled(_) {
return this.debug;
}
/**
* Returns a boolean by checking if an error should be reported.
*/
shouldReport(error) {
if (this.reportErrors === false) {
return false;
}
if (this.ignoreStatuses.includes(error.status)) {
return false;
}
if (error.code && this.ignoreCodes.includes(error.code)) {
return false;
}
if (this.ignoreExceptions.find((exception) => error instanceof exception)) {
return false;
}
return true;
}
/**
* Renders an error to JSON response

@@ -218,40 +257,2 @@ */

/**
* Returns the log level for an error based upon the error
* status code.
*/
getErrorLogLevel(error) {
if (error.status >= 500) {
return 'error';
}
if (error.status >= 400) {
return 'warn';
}
return 'info';
}
/**
* A boolean to control if errors should be rendered with
* all the available debugging info.
*/
isDebuggingEnabled(_) {
return this.debug;
}
/**
* Returns a boolean by checking if an error should be reported.
*/
shouldReport(error) {
if (this.reportErrors === false) {
return false;
}
if (this.ignoreStatuses.includes(error.status)) {
return false;
}
if (error.code && this.ignoreCodes.includes(error.code)) {
return false;
}
if (this.ignoreExceptions.find((exception) => error instanceof exception)) {
return false;
}
return true;
}
/**
* Reports an error during an HTTP request

@@ -258,0 +259,0 @@ */

{
"name": "@adonisjs/http-server",
"version": "6.8.2-11",
"version": "6.8.2-12",
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",

@@ -61,3 +61,3 @@ "main": "build/index.js",

"@japa/runner": "^3.0.0-5",
"@swc/core": "^1.3.71",
"@swc/core": "^1.3.72",
"@types/accepts": "^1.3.5",

@@ -81,3 +81,3 @@ "@types/content-disposition": "^0.5.5",

"@types/vary": "^1.1.0",
"@vinejs/vine": "^1.5.3",
"@vinejs/vine": "^1.6.0",
"autocannon": "^7.11.0",

@@ -87,4 +87,4 @@ "c8": "^8.0.1",

"del-cli": "^5.0.0",
"eslint": "^8.45.0",
"fastify": "^4.20.0",
"eslint": "^8.46.0",
"fastify": "^4.21.0",
"fs-extra": "^11.1.1",

@@ -91,0 +91,0 @@ "get-port": "^7.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc