@riocrypto/common 1.0.3 → 1.0.5

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.
@@ -0,0 +1,8 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class VerificationFailedError extends CustomError {
3
+ statusCode: number;
4
+ constructor();
5
+ serializeErrors(): {
6
+ message: string;
7
+ }[];
8
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerificationFailedError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class VerificationFailedError extends custom_error_1.CustomError {
6
+ constructor() {
7
+ super("User already exists");
8
+ this.statusCode = 409;
9
+ Object.setPrototypeOf(this, VerificationFailedError.prototype);
10
+ }
11
+ serializeErrors() {
12
+ return [{ message: "User already exists" }];
13
+ }
14
+ }
15
+ exports.VerificationFailedError = VerificationFailedError;
@@ -6,6 +6,7 @@ const errorHandler = (err, req, res, next) => {
6
6
  if (err instanceof custom_error_1.CustomError) {
7
7
  return res.status(err.statusCode).send({ errors: err.serializeErrors() });
8
8
  }
9
+ console.error(err);
9
10
  res.status(400).send({
10
11
  erros: [{ message: "Something went wrong" }],
11
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",