@scout9/app 1.0.0-alpha.0.3.8 → 1.0.0-alpha.0.3.9
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/package.json
CHANGED
|
@@ -86,9 +86,9 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
|
|
|
86
86
|
let name = e?.name || 'Runtime Error';
|
|
87
87
|
let message = e?.message || 'Unknown error';
|
|
88
88
|
let code = typeof e?.code === 'number'
|
|
89
|
-
? e
|
|
89
|
+
? e.code
|
|
90
90
|
: typeof e?.status === 'number'
|
|
91
|
-
? e
|
|
91
|
+
? e.status
|
|
92
92
|
: 500;
|
|
93
93
|
if ('response' in e) {
|
|
94
94
|
const response = e.response;
|
|
@@ -105,7 +105,7 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
if (body) {
|
|
108
|
-
console.log(colors.grey(JSON.stringify(body, null, 2)));
|
|
108
|
+
console.log(colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
|
|
109
109
|
}
|
|
110
110
|
if (tag && typeof tag === 'string') {
|
|
111
111
|
message = `${tag}: ${message}`;
|
|
@@ -118,7 +118,7 @@ const handleError = (e, res = undefined, tag = undefined, body = undefined) => {
|
|
|
118
118
|
console.log('STACK:', colors.grey(e.stack));
|
|
119
119
|
}
|
|
120
120
|
if (body) {
|
|
121
|
-
console.log('INPUT:', colors.grey(JSON.stringify(body, null, 2)));
|
|
121
|
+
console.log('INPUT:', colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
|
|
122
122
|
}
|
|
123
123
|
if (res) {
|
|
124
124
|
res.writeHead(code, {'Content-Type': 'application/json'});
|
|
@@ -142,7 +142,7 @@ const handleZodError = ({error, res = undefined, code = 500, status, name, bodyL
|
|
|
142
142
|
console.log(colors.red(`${colors.bold(`${name}`)}:`));
|
|
143
143
|
if (body) {
|
|
144
144
|
console.log(colors.grey(`${bodyLabel}:`));
|
|
145
|
-
console.log(colors.grey(JSON.stringify(body, null, 2)));
|
|
145
|
+
console.log(colors.grey(JSON.stringify(body, null, dev ? 2 : undefined)));
|
|
146
146
|
}
|
|
147
147
|
console.log(colors.red(`${action}${formattedError}`));
|
|
148
148
|
} else {
|