UNPKG

@texagon/nestjs-health

Version:

A comprehensive health monitoring package for NestJS applications with metrics and Kubernetes-ready health checks

54 lines 2.8 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var TestErrorController_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestErrorController = void 0; const common_1 = require("@nestjs/common"); const swagger_1 = require("@nestjs/swagger"); let TestErrorController = TestErrorController_1 = class TestErrorController { constructor() { this.logger = new common_1.Logger(TestErrorController_1.name); } triggerError() { this.logger.debug("About to throw a test error"); this.logger.error("Test error triggered", new Error("This is a test error").stack); throw new common_1.InternalServerErrorException("This is a test error"); } testLogLevels() { this.logger.debug("This is a debug message"); this.logger.log("This is an info message"); this.logger.warn("This is a warning message"); this.logger.error("This is an error message"); return { message: "All log levels tested" }; } }; exports.TestErrorController = TestErrorController; __decorate([ (0, common_1.Get)("error"), (0, swagger_1.ApiOperation)({ summary: "Test endpoint that always throws an error" }), (0, swagger_1.ApiResponse)({ status: 500, description: "Internal Server Error" }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TestErrorController.prototype, "triggerError", null); __decorate([ (0, common_1.Get)("levels"), (0, swagger_1.ApiOperation)({ summary: "Test different log levels" }), (0, swagger_1.ApiResponse)({ status: 200, description: "Logs different levels" }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TestErrorController.prototype, "testLogLevels", null); exports.TestErrorController = TestErrorController = TestErrorController_1 = __decorate([ (0, swagger_1.ApiTags)("test"), (0, common_1.Controller)("test") ], TestErrorController); //# sourceMappingURL=test-error.controller.js.map