moost 0.2.2 → 0.2.3
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/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -178,7 +178,7 @@ var EHttpStatusCode;
|
|
|
178
178
|
DELETE: EHttpStatusCode.Accepted,
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
class
|
|
181
|
+
class HttpError extends Error {
|
|
182
182
|
constructor(code = 500, _body = '') {
|
|
183
183
|
super(typeof _body === 'string' ? _body : _body.message);
|
|
184
184
|
this.code = code;
|
|
@@ -850,7 +850,7 @@ const genericTypesCastPipe = (strict) => {
|
|
|
850
850
|
};
|
|
851
851
|
function typeError(value, targetType, label) {
|
|
852
852
|
const prefix = label ? `Argument "${label}" with value ` : '';
|
|
853
|
-
throw new
|
|
853
|
+
throw new HttpError(400, `${prefix}${JSON.stringify(value)} is not a ${targetType} type`);
|
|
854
854
|
}
|
|
855
855
|
|
|
856
856
|
const DEFAULT_ERROR_LIMIT = 10;
|
|
@@ -869,7 +869,7 @@ const validatePipe = (opts) => {
|
|
|
869
869
|
const valido = getMoostValido();
|
|
870
870
|
const result = yield valido.validateParam(_value, meta, undefined, undefined, undefined, undefined, 0, 0, (opts === null || opts === void 0 ? void 0 : opts.errorLimit) || DEFAULT_ERROR_LIMIT, restoreCtx);
|
|
871
871
|
if (result !== true) {
|
|
872
|
-
throw new
|
|
872
|
+
throw new HttpError(400, {
|
|
873
873
|
statusCode: 400,
|
|
874
874
|
message: typeof result === 'string' ? result : firstString(result),
|
|
875
875
|
error: 'Validation Error',
|
package/dist/index.mjs
CHANGED
|
@@ -176,7 +176,7 @@ var EHttpStatusCode;
|
|
|
176
176
|
DELETE: EHttpStatusCode.Accepted,
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
class
|
|
179
|
+
class HttpError extends Error {
|
|
180
180
|
constructor(code = 500, _body = '') {
|
|
181
181
|
super(typeof _body === 'string' ? _body : _body.message);
|
|
182
182
|
this.code = code;
|
|
@@ -848,7 +848,7 @@ const genericTypesCastPipe = (strict) => {
|
|
|
848
848
|
};
|
|
849
849
|
function typeError(value, targetType, label) {
|
|
850
850
|
const prefix = label ? `Argument "${label}" with value ` : '';
|
|
851
|
-
throw new
|
|
851
|
+
throw new HttpError(400, `${prefix}${JSON.stringify(value)} is not a ${targetType} type`);
|
|
852
852
|
}
|
|
853
853
|
|
|
854
854
|
const DEFAULT_ERROR_LIMIT = 10;
|
|
@@ -867,7 +867,7 @@ const validatePipe = (opts) => {
|
|
|
867
867
|
const valido = getMoostValido();
|
|
868
868
|
const result = yield valido.validateParam(_value, meta, undefined, undefined, undefined, undefined, 0, 0, (opts === null || opts === void 0 ? void 0 : opts.errorLimit) || DEFAULT_ERROR_LIMIT, restoreCtx);
|
|
869
869
|
if (result !== true) {
|
|
870
|
-
throw new
|
|
870
|
+
throw new HttpError(400, {
|
|
871
871
|
statusCode: 400,
|
|
872
872
|
message: typeof result === 'string' ? result : firstString(result),
|
|
873
873
|
error: 'Validation Error',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moost",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@prostojs/infact": "^0.0.13",
|
|
26
26
|
"@prostojs/mate": "^0.1.10",
|
|
27
27
|
"@prostojs/valido": "^0.0.2",
|
|
28
|
-
"@wooksjs/event-core": "^0.2.
|
|
29
|
-
"wooks": "^0.2.
|
|
28
|
+
"@wooksjs/event-core": "^0.2.5",
|
|
29
|
+
"wooks": "^0.2.5"
|
|
30
30
|
},
|
|
31
31
|
"author": "Artem Maltsev",
|
|
32
32
|
"license": "MIT",
|