@seidor-cloud-produtos/orbit-backend-lib 0.0.72 → 0.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
- import { HttpException } from '@nestjs/common';
2
1
  import { UnauthorizedResponse } from '../../../infra/http/errors/unauthorized-response';
3
- export declare class NestNotAllowedError extends HttpException {
2
+ import { OrbitError } from '../errors/orbit-error';
3
+ export declare class NestNotAllowedError extends OrbitError {
4
4
  private input;
5
5
  constructor(input: UnauthorizedResponse);
6
6
  getResponse(): object;
7
+ getStatus(): number;
7
8
  }
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.NestNotAllowedError = void 0;
4
- const common_1 = require('@nestjs/common');
5
- class NestNotAllowedError extends common_1.HttpException {
4
+ const orbit_error_1 = require('../errors/orbit-error');
5
+ class NestNotAllowedError extends orbit_error_1.OrbitError {
6
6
  constructor(input) {
7
7
  super(input.body.message, input.status);
8
8
  this.input = input;
@@ -10,5 +10,8 @@ class NestNotAllowedError extends common_1.HttpException {
10
10
  getResponse() {
11
11
  return this.input.body;
12
12
  }
13
+ getStatus() {
14
+ return 403;
15
+ }
13
16
  }
14
17
  exports.NestNotAllowedError = NestNotAllowedError;
@@ -0,0 +1,2 @@
1
+ import { HttpException } from '@nestjs/common';
2
+ export declare class OrbitError extends HttpException {}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.OrbitError = void 0;
4
+ const common_1 = require('@nestjs/common');
5
+ class OrbitError extends common_1.HttpException {}
6
+ exports.OrbitError = OrbitError;
@@ -0,0 +1,5 @@
1
+ import { ExceptionFilter, ArgumentsHost } from '@nestjs/common';
2
+ import { OrbitError } from '../errors/orbit-error';
3
+ export declare class OrbitExceptionFilter implements ExceptionFilter {
4
+ catch(exception: OrbitError, host: ArgumentsHost): void;
5
+ }
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.OrbitExceptionFilter = void 0;
4
+ const tslib_1 = require('tslib');
5
+ const common_1 = require('@nestjs/common');
6
+ const orbit_error_1 = require('../errors/orbit-error');
7
+ let OrbitExceptionFilter = class OrbitExceptionFilter {
8
+ catch(exception, host) {
9
+ const ctx = host.switchToHttp();
10
+ const response = ctx.getResponse();
11
+ const exceptionResponse = exception.getResponse();
12
+ response.status(exception.getStatus()).json(exceptionResponse);
13
+ }
14
+ };
15
+ exports.OrbitExceptionFilter = OrbitExceptionFilter;
16
+ exports.OrbitExceptionFilter = OrbitExceptionFilter = tslib_1.__decorate(
17
+ [(0, common_1.Catch)(orbit_error_1.OrbitError)],
18
+ OrbitExceptionFilter,
19
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",