@vida-global/core 1.4.0 → 1.4.1

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.
@@ -7,6 +7,7 @@ class ServerError extends Error {
7
7
  get message() { return this.#message; };
8
8
  }
9
9
  class AuthorizationError extends ServerError {}
10
+ class ConflictError extends ServerError {}
10
11
  class ForbiddenError extends ServerError {}
11
12
  class NotFoundError extends ServerError {}
12
13
  class ValidationError extends ServerError {
@@ -21,6 +22,7 @@ class ValidationError extends ServerError {
21
22
 
22
23
  module.exports = {
23
24
  AuthorizationError,
25
+ ConflictError,
24
26
  ForbiddenError,
25
27
  NotFoundError,
26
28
  ServerError,
@@ -1,6 +1,7 @@
1
1
  const { logger } = require('../logger');
2
2
  const { camelize, singularize } = require('inflection');
3
3
  const{ AuthorizationError,
4
+ ConflictError,
4
5
  ForbiddenError,
5
6
  NotFoundError,
6
7
  ServerError,
@@ -124,6 +125,9 @@ class VidaServerController {
124
125
  if (err instanceof AuthorizationError) {
125
126
  await this.renderUnauthorized(err.message);
126
127
 
128
+ } else if (err instanceof ConflictError) {
129
+ await this.renderConflict(err.message);
130
+
127
131
  } else if (err instanceof ForbiddenError) {
128
132
  await this.renderForbidden(err.message);
129
133
 
@@ -675,6 +679,7 @@ class VidaServerController {
675
679
 
676
680
  VidaServerController.prototype.Errors = {
677
681
  Authorization: AuthorizationError,
682
+ Conflict: ConflictError,
678
683
  Forbidden: ForbiddenError,
679
684
  NotFound: NotFoundError,
680
685
  Server: ServerError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vida-global/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Core libraries for supporting Vida development",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -465,6 +465,7 @@ describe('VidaServerController', () => {
465
465
  describe('#performRequest', () => {
466
466
  const errorHandlers = [
467
467
  ['renderUnauthorized', 'AuthorizationError'],
468
+ ['renderConflict', 'ConflictError'],
468
469
  ['renderForbidden', 'ForbiddenError'],
469
470
  ['renderNotFound', 'NotFoundError'],
470
471
  ['renderErrors', 'ValidationError'],