@strapi/utils 4.5.3 → 4.5.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.
Files changed (2) hide show
  1. package/lib/errors.js +17 -7
  2. package/package.json +3 -3
package/lib/errors.js CHANGED
@@ -55,19 +55,28 @@ class ForbiddenError extends ApplicationError {
55
55
  }
56
56
  }
57
57
 
58
- class PayloadTooLargeError extends ApplicationError {
58
+ class UnauthorizedError extends ApplicationError {
59
59
  constructor(message, details) {
60
60
  super(message, details);
61
- this.name = 'PayloadTooLargeError';
62
- this.message = message || 'Entity too large';
61
+ this.name = 'UnauthorizedError';
62
+ this.message = message || 'Unauthorized';
63
63
  }
64
64
  }
65
65
 
66
- class UnauthorizedError extends ApplicationError {
66
+ class RateLimitError extends ApplicationError {
67
67
  constructor(message, details) {
68
68
  super(message, details);
69
- this.name = 'UnauthorizedError';
70
- this.message = message || 'Unauthorized';
69
+ this.name = 'RateLimitError';
70
+ this.message = message || 'Too many requests, please try again later.';
71
+ this.details = details || {};
72
+ }
73
+ }
74
+
75
+ class PayloadTooLargeError extends ApplicationError {
76
+ constructor(message, details) {
77
+ super(message, details);
78
+ this.name = 'PayloadTooLargeError';
79
+ this.message = message || 'Entity too large';
71
80
  }
72
81
  }
73
82
 
@@ -88,7 +97,8 @@ module.exports = {
88
97
  PaginationError,
89
98
  NotFoundError,
90
99
  ForbiddenError,
91
- PayloadTooLargeError,
92
100
  UnauthorizedError,
101
+ RateLimitError,
102
+ PayloadTooLargeError,
93
103
  PolicyError,
94
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/utils",
3
- "version": "4.5.3",
3
+ "version": "4.5.5",
4
4
  "description": "Shared utilities for the Strapi packages",
5
5
  "keywords": [
6
6
  "strapi",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@sindresorhus/slugify": "1.1.0",
39
- "date-fns": "2.29.2",
39
+ "date-fns": "2.29.3",
40
40
  "http-errors": "1.8.1",
41
41
  "lodash": "4.17.21",
42
42
  "yup": "0.32.9"
@@ -45,5 +45,5 @@
45
45
  "node": ">=14.19.1 <=18.x.x",
46
46
  "npm": ">=6.0.0"
47
47
  },
48
- "gitHead": "5453885f7aa329f98d047a6030a8e98ba3cbdb41"
48
+ "gitHead": "8f1988367c1ccbbb1c44866d9dc9fa512e4f3b31"
49
49
  }