@duvdu-v1/duvdu 1.0.8 → 1.0.10

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.
@@ -9,7 +9,7 @@ class BadRequestError extends custom_error_1.CustomError {
9
9
  Object.setPrototypeOf(this, BadRequestError.prototype);
10
10
  }
11
11
  serializeError() {
12
- return [{ message: this.message }];
12
+ return [{ message: this.message || 'bad-request error' }];
13
13
  }
14
14
  }
15
15
  exports.BadRequestError = BadRequestError;
@@ -9,7 +9,7 @@ class NotFound extends custom_error_1.CustomError {
9
9
  Object.setPrototypeOf(this, NotFound.prototype);
10
10
  }
11
11
  serializeError() {
12
- return [{ message: 'not found error' }];
12
+ return [{ message: this.message || 'not found error' }];
13
13
  }
14
14
  }
15
15
  exports.NotFound = NotFound;
@@ -9,7 +9,7 @@ class UnauthenticatedError extends custom_error_1.CustomError {
9
9
  Object.setPrototypeOf(this, UnauthenticatedError.prototype);
10
10
  }
11
11
  serializeError() {
12
- return [{ message: 'un-authenticated error' }];
12
+ return [{ message: this.message || 'un-authenticated error' }];
13
13
  }
14
14
  }
15
15
  exports.UnauthenticatedError = UnauthenticatedError;
@@ -9,7 +9,7 @@ class UnauthorizedError extends custom_error_1.CustomError {
9
9
  Object.setPrototypeOf(this, UnauthorizedError.prototype);
10
10
  }
11
11
  serializeError() {
12
- return [{ message: 'un-unauthorized error' }];
12
+ return [{ message: this.message || 'un-unauthorized error' }];
13
13
  }
14
14
  }
15
15
  exports.UnauthorizedError = UnauthorizedError;
@@ -14,7 +14,7 @@ const globalErrorHandlingMiddleware = (err, req, res, next) => {
14
14
  // mongo dublicate error
15
15
  if (err.name === 'MongoServerError' && err.code == '11000')
16
16
  return res
17
- .status(422)
17
+ .status(400)
18
18
  .json({ errors: [{ message: `${Object.keys(err.keyPattern)} is already exists` }] });
19
19
  // unhandled multer error
20
20
  if (err instanceof multer_1.MulterError)
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@duvdu-v1/duvdu",
3
- "version": "1.0.8",
4
- "main": "./build/index.js",
5
- "types": "./build/index.d.ts",
6
- "files": [
7
- "build/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rimraf ./build",
11
- "build": "npm run clean && tsc",
12
- "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
13
- "lint": "eslint .",
14
- "lint:fix": "eslint --fix .",
15
- "format": "prettier --write ."
16
- },
17
- "keywords": [],
18
- "author": "motemed khaled",
19
- "license": "ISC",
20
- "dependencies": {
21
- "@duvdu-v1/duvdu": "^1.0.5",
22
- "@types/express": "^4.17.21",
23
- "@types/jsonwebtoken": "^9.0.5",
24
- "@types/multer": "^1.4.11",
25
- "@types/node": "^20.11.0",
26
- "@typescript-eslint/eslint-plugin": "^6.19.0",
27
- "@typescript-eslint/parser": "^6.19.0",
28
- "express": "^4.18.2",
29
- "express-async-errors": "^3.1.1",
30
- "express-validator": "^7.0.1",
31
- "jsonwebtoken": "^9.0.2",
32
- "mongoose": "^8.0.4",
33
- "multer": "^1.4.5-lts.1",
34
- "node-nats-streaming": "^0.3.2",
35
- "rimraf": "^5.0.5",
36
- "typescript": "^5.3.3"
37
- },
38
- "devDependencies": {
39
- "del-cli": "^5.1.0",
40
- "eslint": "^8.56.0",
41
- "eslint-config-prettier": "^9.1.0",
42
- "eslint-plugin-import": "^2.29.1",
43
- "eslint-plugin-prettier": "^5.1.3",
44
- "prettier": "^3.2.4"
45
- },
46
- "description": ""
47
- }
1
+ {
2
+ "name": "@duvdu-v1/duvdu",
3
+ "version": "1.0.10",
4
+ "main": "./build/index.js",
5
+ "types": "./build/index.d.ts",
6
+ "files": [
7
+ "build/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rimraf ./build",
11
+ "build": "npm run clean && tsc",
12
+ "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
13
+ "lint": "eslint .",
14
+ "lint:fix": "eslint --fix .",
15
+ "format": "prettier --write ."
16
+ },
17
+ "keywords": [],
18
+ "author": "motemed khaled",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "@duvdu-v1/duvdu": "^1.0.5",
22
+ "@types/express": "^4.17.21",
23
+ "@types/jsonwebtoken": "^9.0.5",
24
+ "@types/multer": "^1.4.11",
25
+ "@types/node": "^20.11.0",
26
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
27
+ "@typescript-eslint/parser": "^6.19.0",
28
+ "express": "^4.18.2",
29
+ "express-async-errors": "^3.1.1",
30
+ "express-validator": "^7.0.1",
31
+ "jsonwebtoken": "^9.0.2",
32
+ "mongoose": "^8.0.4",
33
+ "multer": "^1.4.5-lts.1",
34
+ "node-nats-streaming": "^0.3.2",
35
+ "rimraf": "^5.0.5",
36
+ "typescript": "^5.3.3"
37
+ },
38
+ "devDependencies": {
39
+ "del-cli": "^5.1.0",
40
+ "eslint": "^8.56.0",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-prettier": "^5.1.3",
44
+ "prettier": "^3.2.4"
45
+ },
46
+ "description": ""
47
+ }