pg-mvc-service 2.0.38 → 2.0.39

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.
package/dist/Service.js CHANGED
@@ -140,6 +140,13 @@ class Service {
140
140
  });
141
141
  return;
142
142
  }
143
+ else if (ex instanceof Exception_1.NotFoundException) {
144
+ this.res.status(404).json({
145
+ errorCode: `${this.apiCode}-${ex.ErrorId}`,
146
+ errorMessage: ex.message
147
+ });
148
+ return;
149
+ }
143
150
  this.res.status(500).json({
144
151
  message: 'Internal server error'
145
152
  });
@@ -260,7 +267,7 @@ class Service {
260
267
  }
261
268
  catch (ex) {
262
269
  let response = ex.response;
263
- if (response && [400, 401, 403, 409, 422].includes(response.status)) {
270
+ if (response && [400, 401, 403, 404, 409, 422].includes(response.status)) {
264
271
  return response;
265
272
  }
266
273
  throw ex;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runCron = exports.BaseCron = exports.rollback = exports.migrate = exports.MigrateDatabase = exports.MigrateTable = exports.createTableDoc = exports.TableModel = exports.ResponseType = exports.RequestType = exports.EncryptClient = exports.StringClient = exports.Base64Client = exports.AwsS3Client = exports.createSwagger = exports.UnprocessableException = exports.DbConflictException = exports.ForbiddenException = exports.InputErrorException = exports.AuthException = exports.MaintenanceException = exports.Service = void 0;
3
+ exports.runCron = exports.BaseCron = exports.rollback = exports.migrate = exports.MigrateDatabase = exports.MigrateTable = exports.createTableDoc = exports.TableModel = exports.ResponseType = exports.RequestType = exports.EncryptClient = exports.StringClient = exports.Base64Client = exports.AwsS3Client = exports.createSwagger = exports.NotFoundException = exports.UnprocessableException = exports.DbConflictException = exports.ForbiddenException = exports.InputErrorException = exports.AuthException = exports.MaintenanceException = exports.Service = void 0;
4
4
  var Service_1 = require("./Service");
5
5
  Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return Service_1.Service; } });
6
6
  var Exception_1 = require("./exceptions/Exception");
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "InputErrorException", { enumerable: true, get: f
10
10
  Object.defineProperty(exports, "ForbiddenException", { enumerable: true, get: function () { return Exception_1.ForbiddenException; } });
11
11
  Object.defineProperty(exports, "DbConflictException", { enumerable: true, get: function () { return Exception_1.DbConflictException; } });
12
12
  Object.defineProperty(exports, "UnprocessableException", { enumerable: true, get: function () { return Exception_1.UnprocessableException; } });
13
+ Object.defineProperty(exports, "NotFoundException", { enumerable: true, get: function () { return Exception_1.NotFoundException; } });
13
14
  var Swagger_1 = require("./documents/Swagger");
14
15
  Object.defineProperty(exports, "createSwagger", { enumerable: true, get: function () { return Swagger_1.createSwagger; } });
15
16
  var AwsS3Client_1 = require("./clients/AwsS3Client");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.38",
3
+ "version": "2.0.39",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
package/src/Service.ts CHANGED
@@ -121,6 +121,12 @@ export class Service {
121
121
  errorMessage : ex.message
122
122
  });
123
123
  return;
124
+ } else if (ex instanceof NotFoundException) {
125
+ this.res.status(404).json({
126
+ errorCode : `${this.apiCode}-${ex.ErrorId}`,
127
+ errorMessage : ex.message
128
+ });
129
+ return;
124
130
  }
125
131
 
126
132
  this.res.status(500).json({
@@ -254,7 +260,7 @@ export class Service {
254
260
  }
255
261
  } catch (ex) {
256
262
  let response = (ex as any).response as AxiosResponse<TResponse>;
257
- if (response && [400, 401, 403, 409, 422].includes(response.status)) {
263
+ if (response && [400, 401, 403, 404, 409, 422].includes(response.status)) {
258
264
  return response;
259
265
  }
260
266
  throw ex;
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Service } from './Service';
2
- export { MaintenanceException, AuthException, InputErrorException, ForbiddenException, DbConflictException, UnprocessableException } from './exceptions/Exception';
2
+ export { MaintenanceException, AuthException, InputErrorException, ForbiddenException, DbConflictException, UnprocessableException, NotFoundException } from './exceptions/Exception';
3
3
  export { createSwagger } from './documents/Swagger';
4
4
  export { AwsS3Client } from './clients/AwsS3Client';
5
5
  export { Base64Client } from './clients/Base64Client';