wgt-node-utils 1.2.1 → 1.2.2

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 +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgt-node-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "WGT工具类包",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -386,7 +386,7 @@ class wgtNodeUtils {
386
386
  console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${ err.config.data ? JSON.stringify(err.config.data) : ''}}`);
387
387
  console.error(`response: ${JSON.stringify( this.safeStringify(err.response))}`);
388
388
  feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
389
- if (usePageUrl) {
389
+ if (usePageUrl && req) {
390
390
  const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
391
391
  feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
392
392
  }
@@ -396,6 +396,10 @@ class wgtNodeUtils {
396
396
  console.error(`============${new Date().toLocaleString()}===========`);
397
397
  console.error(message);
398
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
+ }
399
403
  this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
400
404
  }
401
405
  } catch (e) {