@jayfong/x-server 2.78.0 → 2.78.1
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/lib/_cjs/cli/cli.js +0 -0
- package/lib/_cjs/core/handler.js +4 -4
- package/lib/core/handler.js +5 -5
- package/package.json +1 -1
package/lib/_cjs/cli/cli.js
CHANGED
|
File without changes
|
package/lib/_cjs/core/handler.js
CHANGED
|
@@ -110,12 +110,12 @@ class Handler {
|
|
|
110
110
|
throw err;
|
|
111
111
|
}
|
|
112
112
|
// 网络错误
|
|
113
|
-
if (err instanceof _got.HTTPError) {
|
|
113
|
+
if (err instanceof _got.HTTPError || err instanceof _got.RequestError || err instanceof _got.TimeoutError || err instanceof _got.ParseError) {
|
|
114
114
|
console.error('网络请求错误', {
|
|
115
|
-
error: `${err.code || ''}
|
|
116
|
-
response: err.options.responseType !== 'buffer' ? (0, _vtils.toSingleLineString)(String(err.response.body),
|
|
115
|
+
error: `${err.code || ''}__${err.name || ''}__${err.message || ''}`,
|
|
116
|
+
response: err.response?.body && err.options.responseType !== 'buffer' ? (0, _vtils.toSingleLineString)(String(err.response.body), 100) : '',
|
|
117
117
|
method: err.options.method,
|
|
118
|
-
url: err.options.url,
|
|
118
|
+
url: err.options.url.toString(),
|
|
119
119
|
headers: JSON.stringify(err.options.headers || {}),
|
|
120
120
|
query: (err.options.search ?? err.options.searchParams?.toString()) || '',
|
|
121
121
|
body: err.options.body?.toString() ?? (err.options.form ? JSON.stringify(err.options.form) : '')
|
package/lib/core/handler.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTTPError as
|
|
1
|
+
import { HTTPError as GotHTTPError, ParseError as GotParseError, RequestError as GotRequestError, TimeoutError as GotTimeoutError } from 'got';
|
|
2
2
|
import LZString from 'lz-string';
|
|
3
3
|
import { DataPacker, base64UrlEncode, rot13, toSingleLineString } from 'vtils';
|
|
4
4
|
import * as vae from 'vtils/vae';
|
|
@@ -104,12 +104,12 @@ export class Handler {
|
|
|
104
104
|
throw err;
|
|
105
105
|
}
|
|
106
106
|
// 网络错误
|
|
107
|
-
if (err instanceof
|
|
107
|
+
if (err instanceof GotHTTPError || err instanceof GotRequestError || err instanceof GotTimeoutError || err instanceof GotParseError) {
|
|
108
108
|
console.error('网络请求错误', {
|
|
109
|
-
error: `${err.code || ''}
|
|
110
|
-
response: err.options.responseType !== 'buffer' ? toSingleLineString(String(err.response.body),
|
|
109
|
+
error: `${err.code || ''}__${err.name || ''}__${err.message || ''}`,
|
|
110
|
+
response: err.response?.body && err.options.responseType !== 'buffer' ? toSingleLineString(String(err.response.body), 100) : '',
|
|
111
111
|
method: err.options.method,
|
|
112
|
-
url: err.options.url,
|
|
112
|
+
url: err.options.url.toString(),
|
|
113
113
|
headers: JSON.stringify(err.options.headers || {}),
|
|
114
114
|
query: (err.options.search ?? err.options.searchParams?.toString()) || '',
|
|
115
115
|
body: err.options.body?.toString() ?? (err.options.form ? JSON.stringify(err.options.form) : '')
|