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

kamboja

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kamboja - npm Package Compare versions

Comparing version 0.0.1-46 to 0.0.1-47

2

lib/dts/engine/error-handler.d.ts

@@ -8,3 +8,3 @@ import { Core } from "../index";

constructor(error: any, option: Core.KambojaOption, request: Core.HttpRequest, response: Core.HttpResponse);
execute(): void;
execute(): Promise<void>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var index_1 = require("../index");

@@ -13,26 +14,37 @@ var Xml = require("xml");

ErrorHandler.prototype.execute = function () {
if (this.option.errorHandler) {
this.option.errorHandler(new index_1.Core.HttpError(this.error.status, this.error, this.request, this.response));
}
else {
var routeInfo = this.error.routeInfo;
if (routeInfo && routeInfo.classMetaData.baseClass == "ApiController") {
var actionResult = new index_1.ApiActionResult(this.error.message, this.error.status);
actionResult.execute(this.request, this.response, routeInfo);
}
else if (this.request.getHeader("Content-Type") == "application/json") {
var actionResult = new index_1.ApiActionResult(this.error.message, this.error.status);
actionResult.execute(this.request, this.response, routeInfo);
}
else if (this.request.getHeader("Content-Type") == "text/xml") {
this.response.setContentType("text/xml");
this.response.status(this.error.status);
this.response.send(Xml(this.error.message));
this.response.end();
}
else {
this.response.status(this.error.status);
this.response.view("error", {});
}
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
var routeInfo, actionResult;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.option.errorHandler) return [3 /*break*/, 1];
this.option.errorHandler(new index_1.Core.HttpError(this.error.status, this.error, this.request, this.response));
return [3 /*break*/, 4];
case 1:
routeInfo = this.error.routeInfo;
if (!(routeInfo && routeInfo.classMetaData.baseClass == "ApiController")) return [3 /*break*/, 3];
actionResult = new index_1.ApiActionResult(this.error.message, this.error.status);
return [4 /*yield*/, actionResult.execute(this.request, this.response, routeInfo)];
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
if (this.request.getHeader("Content-Type") == "application/json") {
this.response.json(this.error.message, this.error.status);
}
else if (this.request.getHeader("Content-Type") == "text/xml") {
this.response.setContentType("text/xml");
this.response.status(this.error.status);
this.response.send(Xml(this.error.message));
this.response.end();
}
else {
this.response.status(this.error.status);
this.response.view("error", {});
}
_a.label = 4;
case 4: return [2 /*return*/];
}
});
});
};

@@ -39,0 +51,0 @@ return ErrorHandler;

{
"name": "kamboja",
"version": "0.0.1-46",
"version": "0.0.1-47",
"description": "MVC Framework powered by TypeScript",

@@ -5,0 +5,0 @@ "main": "lib/source/index.js",

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