cgserver 6.4.6 → 6.4.7

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.
@@ -570,29 +570,34 @@ class core {
570
570
  return;
571
571
  }
572
572
  try {
573
+ let rs = undefined;
573
574
  if (core.isAsyncFunc(func)) {
574
575
  if (thisArg) {
575
- await func.call(thisArg, params).catch((reason) => {
576
+ rs = await func.call(thisArg, params).catch((reason) => {
576
577
  Log_1.GLog.error(reason);
578
+ rs = { errcode: { id: 1008611, des: "failed" } };
577
579
  });
578
580
  }
579
581
  else {
580
- await func(params).catch((reason) => {
582
+ rs = await func(params).catch((reason) => {
581
583
  Log_1.GLog.error(reason);
584
+ rs = { errcode: { id: 1008612, des: "failed" } };
582
585
  });
583
586
  }
584
587
  }
585
588
  else {
586
589
  if (thisArg) {
587
- func.call(thisArg, params);
590
+ rs = func.call(thisArg, params);
588
591
  }
589
592
  else {
590
- func(params);
593
+ rs = func(params);
591
594
  }
592
595
  }
596
+ return rs;
593
597
  }
594
598
  catch (e) {
595
599
  Log_1.GLog.error(e.stack);
600
+ return { errcode: { id: 1008613, des: "failed" } };
596
601
  }
597
602
  }
598
603
  }
@@ -25,8 +25,8 @@ class AsyncQueueItem {
25
25
  if (!funcitem.func) {
26
26
  continue;
27
27
  }
28
- await cgserver_1.core.safeCall(funcitem.func, funcitem.thisArg, funcitem.params);
29
- await cgserver_1.core.safeCall(funcitem.resolve);
28
+ let rs = await cgserver_1.core.safeCall(funcitem.func, funcitem.thisArg, funcitem.params);
29
+ await cgserver_1.core.safeCall(funcitem.resolve, null, rs);
30
30
  }
31
31
  this.running = false;
32
32
  }
@@ -100,5 +100,5 @@ export declare class core {
100
100
  */
101
101
  static convertToGlobalStr(num: number): string;
102
102
  static sleep(milliseconds: any): Promise<unknown>;
103
- static safeCall(func: Function, thisArg?: any, ...params: any[]): Promise<void>;
103
+ static safeCall(func: Function, thisArg?: any, ...params: any[]): Promise<any>;
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "6.4.6",
3
+ "version": "6.4.7",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",