gg-express 1.0.146 → 1.0.148

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.
@@ -52,14 +52,19 @@ class GGExpressV3 {
52
52
  // console.log("req.url", req.url)
53
53
  // if (req.query) console.log("req.query", req.query)
54
54
  // if (req.body) console.log("req.body", req.body)
55
- if (method === "get" &&
56
- isEmptyZodObject(options.requireParams.data) === false) {
57
- options.requireParams.data.parse(autoCastBySchema(req.query.data, options.requireParams.data));
55
+ try {
56
+ if (method === "get" &&
57
+ isEmptyZodObject(options.requireParams.data) === false) {
58
+ options.requireParams.data.parse(autoCastBySchema(req.query.data, options.requireParams.data));
59
+ }
60
+ else if (method === "post" ||
61
+ method === "put" ||
62
+ method === "delete") {
63
+ options.requireParams.data.parse(autoCastBySchema(req.body.data.data, options.requireParams.data));
64
+ }
58
65
  }
59
- else if (method === "post" ||
60
- method === "put" ||
61
- method === "delete") {
62
- options.requireParams.data.parse(autoCastBySchema(req.body.data.data, options.requireParams.data));
66
+ catch (error) {
67
+ new Error(error);
63
68
  }
64
69
  next();
65
70
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg-express",
3
- "version": "1.0.146",
3
+ "version": "1.0.148",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
@@ -108,21 +108,25 @@ export default class GGExpressV3<
108
108
  // console.log("req.url", req.url)
109
109
  // if (req.query) console.log("req.query", req.query)
110
110
  // if (req.body) console.log("req.body", req.body)
111
- if (
112
- method === "get" &&
113
- isEmptyZodObject(options.requireParams.data) === false
114
- ) {
115
- options.requireParams.data.parse(
116
- autoCastBySchema(req.query.data, options.requireParams.data),
117
- )
118
- } else if (
119
- method === "post" ||
120
- method === "put" ||
121
- method === "delete"
122
- ) {
123
- options.requireParams.data.parse(
124
- autoCastBySchema(req.body.data.data, options.requireParams.data),
125
- )
111
+ try {
112
+ if (
113
+ method === "get" &&
114
+ isEmptyZodObject(options.requireParams.data) === false
115
+ ) {
116
+ options.requireParams.data.parse(
117
+ autoCastBySchema(req.query.data, options.requireParams.data),
118
+ )
119
+ } else if (
120
+ method === "post" ||
121
+ method === "put" ||
122
+ method === "delete"
123
+ ) {
124
+ options.requireParams.data.parse(
125
+ autoCastBySchema(req.body.data.data, options.requireParams.data),
126
+ )
127
+ }
128
+ } catch (error) {
129
+ new Error(error as any)
126
130
  }
127
131
  next()
128
132
  },