wgt-node-utils 1.2.3 → 1.2.4

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/package.json +1 -1
  2. package/src/index.js +6 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgt-node-utils",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "WGT工具类包",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -375,7 +375,11 @@ class wgtNodeUtils {
375
375
  useSendFeiShu = false
376
376
  } = options;
377
377
  try {
378
- let feiShuContent = ''
378
+ let feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
379
+ if (usePageUrl && req) {
380
+ const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
381
+ feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
382
+ }
379
383
  if (!err) {
380
384
  console.warn(`============${new Date().toLocaleString()}===========`);
381
385
  console.warn(message);
@@ -385,21 +389,12 @@ class wgtNodeUtils {
385
389
  console.error(`${message} [${err.config.method}]: ${err.config.url}`);
386
390
  console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${ err.config.data ? JSON.stringify(err.config.data) : ''}}`);
387
391
  console.error(`response: ${JSON.stringify( this.safeStringify(err.response))}`);
388
- feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
389
- if (usePageUrl && req) {
390
- const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
391
- feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
392
- }
392
+
393
393
  this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
394
394
 
395
395
  } else {
396
396
  console.error(`============${new Date().toLocaleString()}===========`);
397
397
  console.error(message);
398
- feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
399
- if (usePageUrl && req) {
400
- const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
401
- feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
402
- }
403
398
  this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
404
399
  }
405
400
  } catch (e) {