@xuda.io/xuda-worker-bundle 1.3.2698 → 1.3.2700

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/index.js +382 -78
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5231,7 +5231,17 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
5231
5231
  resolve(job_num);
5232
5232
  }
5233
5233
  if (i > 200) {
5234
- console.error('deadlock detected');
5234
+ func.utils.report_issue(SESSION_ID, {
5235
+ code: 'RUN_MSG_DSC_050',
5236
+ source: 'func.datasource.run_events_functions',
5237
+ message: 'deadlock detected',
5238
+ type: 'E',
5239
+ details: {
5240
+ job_num,
5241
+ event_id,
5242
+ dsSessionP,
5243
+ },
5244
+ });
5235
5245
  clearInterval(interval);
5236
5246
  resolve(job_num);
5237
5247
  }
@@ -6642,7 +6652,19 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
6642
6652
  }
6643
6653
  }
6644
6654
  } catch (err) {
6645
- // console.error(err);
6655
+ await func.utils.report_issue(SESSION_ID, {
6656
+ code: 'RUN_MSG_DSC_060',
6657
+ source: 'Datasource get value',
6658
+ message: 'Datasource row lookup failed',
6659
+ type: 'W',
6660
+ err,
6661
+ details: {
6662
+ dsSessionP,
6663
+ field_id: _field_id,
6664
+ record_id: recordId,
6665
+ },
6666
+ skip_log: false,
6667
+ });
6646
6668
  }
6647
6669
  }
6648
6670
 
@@ -6652,7 +6674,21 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
6652
6674
  if (typeof _ds.data_feed?.rows?.[row_idx]?.[_field_id] !== 'undefined') {
6653
6675
  return await return_value(_field_id, _ds.data_feed.rows[row_idx][_field_id]);
6654
6676
  }
6655
- } catch (error) {}
6677
+ } catch (error) {
6678
+ await func.utils.report_issue(SESSION_ID, {
6679
+ code: 'RUN_MSG_DSC_060',
6680
+ source: 'Datasource get value',
6681
+ message: 'Datasource row lookup failed',
6682
+ type: 'W',
6683
+ err: error,
6684
+ details: {
6685
+ dsSessionP,
6686
+ field_id: _field_id,
6687
+ record_id: _ds.currentRecordId,
6688
+ },
6689
+ skip_log: false,
6690
+ });
6691
+ }
6656
6692
 
6657
6693
  return await search_in_parameters(fieldIdP);
6658
6694
  };
@@ -7969,11 +8005,213 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
7969
8005
  }
7970
8006
  };
7971
8007
 
8008
+ func.utils._error_registry_module = func.utils._error_registry_module || null;
8009
+ func.utils._error_registry_pending = func.utils._error_registry_pending || null;
8010
+
8011
+ func.utils.get_error_registry = async function (SESSION_ID) {
8012
+ if (func.utils._error_registry_module) {
8013
+ return func.utils._error_registry_module;
8014
+ }
8015
+
8016
+ if (func.utils._error_registry_pending) {
8017
+ return await func.utils._error_registry_pending;
8018
+ }
8019
+
8020
+ if (!SESSION_ID || !SESSION_OBJ?.[SESSION_ID]) {
8021
+ return null;
8022
+ }
8023
+
8024
+ func.utils._error_registry_pending = func.common
8025
+ .get_module(SESSION_ID, 'xuda-error-registry-module.mjs')
8026
+ .then((module) => {
8027
+ func.utils._error_registry_module = module;
8028
+ return module;
8029
+ })
8030
+ .catch((err) => {
8031
+ console.warn('XUDA WARNING RUN_MSG_NET_010', 'Failed to load error registry module', err);
8032
+ return null;
8033
+ })
8034
+ .finally(() => {
8035
+ func.utils._error_registry_pending = null;
8036
+ });
8037
+
8038
+ return await func.utils._error_registry_pending;
8039
+ };
8040
+
8041
+ func.utils._normalize_issue_severity = function (type, fallback = 'error') {
8042
+ if (!type) return fallback;
8043
+ const normalized = type.toString().toLowerCase();
8044
+ if (['w', 'warn', 'warning'].includes(normalized)) return 'warning';
8045
+ if (['i', 'info', 'log'].includes(normalized)) return 'info';
8046
+ return 'error';
8047
+ };
8048
+
8049
+ func.utils._serialize_issue_value = function (value, seen = new WeakSet()) {
8050
+ if (value instanceof Error) {
8051
+ return {
8052
+ name: value.name,
8053
+ message: value.message,
8054
+ stack: value.stack,
8055
+ cause: value.cause,
8056
+ };
8057
+ }
8058
+
8059
+ if (typeof value === 'undefined' || value === null) {
8060
+ return value;
8061
+ }
8062
+
8063
+ if (typeof value === 'function') {
8064
+ return `[Function ${value.name || 'anonymous'}]`;
8065
+ }
8066
+
8067
+ if (typeof value !== 'object') {
8068
+ return value;
8069
+ }
8070
+
8071
+ if (seen.has(value)) {
8072
+ return '[Circular]';
8073
+ }
8074
+
8075
+ seen.add(value);
8076
+
8077
+ if (Array.isArray(value)) {
8078
+ return value.map((item) => func.utils._serialize_issue_value(item, seen));
8079
+ }
8080
+
8081
+ const ret = {};
8082
+ for (const [key, val] of Object.entries(value)) {
8083
+ ret[key] = func.utils._serialize_issue_value(val, seen);
8084
+ }
8085
+ return ret;
8086
+ };
8087
+
8088
+ func.utils._stringify_issue_message = function (value) {
8089
+ if (typeof value === 'undefined' || value === null) {
8090
+ return '';
8091
+ }
8092
+
8093
+ if (typeof value === 'string') {
8094
+ return value;
8095
+ }
8096
+
8097
+ if (value instanceof Error) {
8098
+ return value.message || value.toString();
8099
+ }
8100
+
8101
+ try {
8102
+ return JSON.stringify(func.utils._serialize_issue_value(value));
8103
+ } catch (error) {
8104
+ return value?.toString?.() || '';
8105
+ }
8106
+ };
8107
+
8108
+ func.utils._build_fallback_issue_definition = function (payload = {}) {
8109
+ const code = payload.code || 'RUN_MSG_GEN_000';
8110
+ const severity = func.utils._normalize_issue_severity(payload.type || payload.severity, code.startsWith('CHK_MSG_') ? 'warning' : 'error');
8111
+
8112
+ return {
8113
+ code,
8114
+ title: payload.title || (code.startsWith('CHK_MSG_') ? 'Studio Checker Validation Issue' : 'Runtime Error'),
8115
+ severity,
8116
+ domain: code.startsWith('CHK_MSG_') ? 'checker' : 'runtime',
8117
+ category: payload.category || 'general',
8118
+ summary: payload.message || 'The runtime reported an issue.',
8119
+ help_slug: payload.help_slug || code.toLowerCase().replace(/_/g, '-'),
8120
+ };
8121
+ };
8122
+
8123
+ func.utils.report_issue = async function (SESSION_ID, payload = {}) {
8124
+ const err = payload.err instanceof Error ? payload.err : payload.error instanceof Error ? payload.error : null;
8125
+ const source = payload.source || payload.method || 'runtime';
8126
+ const message = func.utils._stringify_issue_message(
8127
+ typeof payload.message !== 'undefined' ? payload.message : typeof payload.msg !== 'undefined' ? payload.msg : err || payload.details || 'Unknown runtime issue',
8128
+ );
8129
+
8130
+ try {
8131
+ const registry = await func.utils.get_error_registry(SESSION_ID);
8132
+ const registry_payload = {
8133
+ code: payload.code,
8134
+ source,
8135
+ message,
8136
+ type: payload.type || payload.severity,
8137
+ err,
8138
+ details: payload.details,
8139
+ category: payload.category,
8140
+ };
8141
+
8142
+ let definition = null;
8143
+ if (registry?.get_error_definition && payload.code) {
8144
+ definition = registry.get_error_definition(payload.code, registry_payload);
8145
+ }
8146
+ if (!definition && registry?.get_runtime_report_definition) {
8147
+ definition = registry.get_runtime_report_definition(registry_payload);
8148
+ }
8149
+ if (!definition) {
8150
+ definition = func.utils._build_fallback_issue_definition({
8151
+ ...payload,
8152
+ source,
8153
+ message,
8154
+ });
8155
+ }
8156
+
8157
+ const severity = func.utils._normalize_issue_severity(payload.type || payload.severity, definition.severity || 'error');
8158
+ const error_code = definition.code || payload.code || 'RUN_MSG_GEN_000';
8159
+ const error_title = definition.title || payload.title || 'Runtime Error';
8160
+ const help_slug = definition.help_slug || error_code.toLowerCase().replace(/_/g, '-');
8161
+ const console_method = severity === 'warning' ? 'warn' : severity === 'info' ? 'log' : 'error';
8162
+ const _session = SESSION_OBJ?.[SESSION_ID];
8163
+ const report = {
8164
+ error_code,
8165
+ error_title,
8166
+ help_slug,
8167
+ severity,
8168
+ error_domain: definition.domain || 'runtime',
8169
+ error_category: definition.category || payload.category || 'general',
8170
+ source,
8171
+ message,
8172
+ stack: err?.stack || null,
8173
+ app_id: _session?.app_id || payload.app_id || null,
8174
+ session_id: SESSION_ID || null,
8175
+ worker: !!glb?.IS_WORKER,
8176
+ summary: definition.summary || message,
8177
+ };
8178
+ const details = {
8179
+ report,
8180
+ error: func.utils._serialize_issue_value(err),
8181
+ context: func.utils._serialize_issue_value(payload.details),
8182
+ extra: func.utils._serialize_issue_value(payload.extra),
8183
+ };
8184
+ const console_prefix = `XUDA ${console_method.toUpperCase()} ${error_code}`;
8185
+ const console_summary = `${error_title}: ${source}${message ? ' | ' + message : ''}`;
8186
+
8187
+ if (glb?.debug_js && console.groupCollapsed) {
8188
+ console.groupCollapsed(console_prefix, console_summary);
8189
+ console[console_method](report);
8190
+ if (details.context) console.log('context', details.context);
8191
+ if (err) console.error(err);
8192
+ console.groupEnd();
8193
+ } else {
8194
+ console[console_method](console_prefix, console_summary, {
8195
+ help_slug,
8196
+ });
8197
+ }
8198
+
8199
+ if (!payload.skip_log && SESSION_ID && _session) {
8200
+ await func.utils.write_log(SESSION_ID, source, message || error_title, console_method, payload.log_source || 'runtime', details, report);
8201
+ }
8202
+
8203
+ return report;
8204
+ } catch (report_err) {
8205
+ console.error('XUDA ERROR RUN_MSG_GEN_000', 'Failed to report runtime issue', report_err, {
8206
+ source,
8207
+ message,
8208
+ payload,
8209
+ });
8210
+ return null;
8211
+ }
8212
+ };
8213
+
7972
8214
  func.utils.debug_report = async function (SESSION_ID, sourceP, msgP, typeP, errP, objP) {
7973
- var _session = SESSION_OBJ[SESSION_ID];
7974
- var details = [sourceP];
7975
- if (errP) details.push(errP);
7976
- if (objP) details.push(objP);
7977
8215
  if (!typeP || typeP === 'E') {
7978
8216
  setTimeout(() => {
7979
8217
  // if (
@@ -7985,52 +8223,15 @@ func.utils.debug_report = async function (SESSION_ID, sourceP, msgP, typeP, errP
7985
8223
  // func.index.delete_pouch(SESSION_ID);
7986
8224
  // }
7987
8225
  }, 1000);
7988
-
7989
- // // temp inactive cause to loop
7990
-
7991
- // func.utils.alerts.invoke(
7992
- // SESSION_ID,
7993
- // "system_msg",
7994
- // "SYS_MSG_1240",
7995
- // "debug",
7996
- // null,
7997
- // msgP,
7998
- // sourceP //arguments.callee.caller.toString()- deprecated es6
7999
- // );
8000
- console.error('XUDA', 'ERROR', sourceP, msgP, details);
8001
-
8002
- if (typeof IS_API_SERVER !== 'undefined' || typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
8003
- return __.rpi.write_log(SESSION_OBJ[SESSION_ID].app_id, 'error', 'worker', 'runtime', msgP, null, objP, sourceP);
8004
- }
8005
-
8006
- if (glb.IS_WORKER) {
8007
- let obj = {
8008
- service: 'write_log',
8009
- data: msgP,
8010
- log_type: 'error',
8011
- id: STUDIO_WEBSOCKET_CONNECTION_ID,
8012
- uid: _session.USR_OBJ._id,
8013
- source: 'runtime',
8014
- app_id: _session.app_id,
8015
- gtp_token: _session.gtp_token,
8016
- app_token: _session.app_token,
8017
- };
8018
-
8019
- return func.utils.post_back_to_client(SESSION_ID, 'write_log', _session.worker_id, obj);
8020
- }
8021
-
8022
- // // temp inactive cause to loop
8023
- // if (!glb.IS_WORKER) {
8024
- // await func.common.db(SESSION_ID, "write_log", {
8025
- // client_id: _session?.SYS_GLOBAL_OBJ_CLIENT_INFO?.fingerprint,
8026
- // source: sourceP,
8027
- // log_type: "error",
8028
- // msg: msgP,
8029
- // });
8030
- // }
8031
8226
  }
8032
- if (typeP === 'W') console.warn('XUDA', 'WARNING', msgP, details);
8033
- if (typeP === 'I') console.log('XUDA', 'INFO', msgP, details);
8227
+
8228
+ await func.utils.report_issue(SESSION_ID, {
8229
+ source: sourceP,
8230
+ message: msgP,
8231
+ type: typeP,
8232
+ err: errP,
8233
+ details: objP,
8234
+ });
8034
8235
  };
8035
8236
 
8036
8237
  func.utils.request_error = function (SESSION_ID, type, e) {
@@ -8966,8 +9167,18 @@ func.utils.get_plugin_resource = function (SESSION_ID, plugin_name, plugin_resou
8966
9167
  const plugin_resource_res = await import(`${get_path(plugin_resource)}`);
8967
9168
  resolve(plugin_resource_res);
8968
9169
  } catch (err) {
8969
- console.error(err);
8970
- reject();
9170
+ await func.utils.report_issue(SESSION_ID, {
9171
+ code: 'RUN_MSG_GUI_020',
9172
+ source: 'func.utils.get_plugin_resource',
9173
+ message: 'plugin setup import failed',
9174
+ err,
9175
+ details: {
9176
+ plugin_name,
9177
+ plugin_resource,
9178
+ plugin_path: get_path(plugin_resource),
9179
+ },
9180
+ });
9181
+ reject(err);
8971
9182
  }
8972
9183
  });
8973
9184
  };
@@ -9017,19 +9228,53 @@ func.utils.get_plugin_npm_cdn = async function (SESSION_ID, plugin_name, resourc
9017
9228
  return get_path(resource);
9018
9229
  };
9019
9230
 
9020
- func.utils.write_log = async function (SESSION_ID, method = '', msg = '', log_type = 'error', source = 'runtime', details) {
9231
+ func.utils.write_log = async function (SESSION_ID, method = '', msg = '', log_type = 'error', source = 'runtime', details, meta = {}) {
9021
9232
  const _session = SESSION_OBJ[SESSION_ID];
9022
- if (typeof IS_API_SERVER !== 'undefined' || typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
9023
- return __.rpi.write_log(_session.app_id, log_type, source, msg, details);
9024
- }
9025
-
9026
- await func.common.db(SESSION_ID, 'write_log', {
9233
+ const body = {
9027
9234
  msg,
9028
9235
  log_type,
9029
9236
  source,
9030
9237
  details,
9031
9238
  method,
9032
- });
9239
+ ...meta,
9240
+ };
9241
+
9242
+ if (typeof IS_API_SERVER !== 'undefined' || typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
9243
+ return __.rpi.write_log(
9244
+ _session?.app_id,
9245
+ log_type,
9246
+ source,
9247
+ msg,
9248
+ details,
9249
+ null,
9250
+ body,
9251
+ method,
9252
+ _session?.SYS_GLOBAL_OBJ_CLIENT_INFO?.fingerprint,
9253
+ );
9254
+ }
9255
+
9256
+ if (glb.IS_WORKER) {
9257
+ let obj = {
9258
+ service: 'write_log',
9259
+ data: body,
9260
+ log_type,
9261
+ id: STUDIO_WEBSOCKET_CONNECTION_ID,
9262
+ uid: _session?.USR_OBJ?._id,
9263
+ source,
9264
+ app_id: _session?.app_id,
9265
+ gtp_token: _session?.gtp_token,
9266
+ app_token: _session?.app_token,
9267
+ };
9268
+
9269
+ return func.utils.post_back_to_client(SESSION_ID, 'write_log', _session.worker_id, obj);
9270
+ }
9271
+
9272
+ await func.common.db(SESSION_ID, 'write_log', body);
9273
+ };
9274
+
9275
+ func.utils.get_error_catalog_manifest = async function (SESSION_ID) {
9276
+ const registry = await func.utils.get_error_registry(SESSION_ID);
9277
+ return registry?.get_error_catalog_manifest?.() || null;
9033
9278
  };
9034
9279
 
9035
9280
  func.utils.get_resource_filename = function (build, filename) {
@@ -10368,7 +10613,16 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
10368
10613
 
10369
10614
  const params_obj = func.common.getObjectFromUrl(url, glb.ROOT_ELEMENT_ATTRIBUTES);
10370
10615
  if (!params_obj.prog) {
10371
- return console.warn('prog empty');
10616
+ await func.utils.report_issue(SESSION_ID, {
10617
+ code: 'RUN_MSG_EVT_030',
10618
+ source: 'func.events.execute_PENDING_OPEN_URL_EVENTS',
10619
+ message: 'prog empty',
10620
+ type: 'W',
10621
+ details: {
10622
+ url,
10623
+ },
10624
+ });
10625
+ return;
10372
10626
  }
10373
10627
 
10374
10628
  await func.utils.TREE_OBJ.get(SESSION_ID, params_obj.prog);
@@ -10389,18 +10643,37 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
10389
10643
  source_functionP: 'pendingUrlEvent_embed',
10390
10644
  });
10391
10645
  } else {
10392
- console.error('Program not exist', params_obj.prog_id);
10646
+ await func.utils.report_issue(SESSION_ID, {
10647
+ code: 'RUN_MSG_EVT_010',
10648
+ source: 'func.events.execute_PENDING_OPEN_URL_EVENTS',
10649
+ message: 'Program not exist',
10650
+ type: 'E',
10651
+ details: {
10652
+ prog_id: params_obj.prog_id,
10653
+ prog: params_obj.prog,
10654
+ },
10655
+ });
10393
10656
  func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
10394
10657
  }
10395
10658
  } else {
10396
- console.warn('url empty');
10659
+ await func.utils.report_issue(SESSION_ID, {
10660
+ code: 'RUN_MSG_EVT_030',
10661
+ source: 'func.events.execute_PENDING_OPEN_URL_EVENTS',
10662
+ message: 'url empty',
10663
+ type: 'W',
10664
+ });
10397
10665
  }
10398
10666
  }
10399
10667
  };
10400
10668
  func.events.invoke = async function (event_id) {
10401
10669
  var _session = SESSION_OBJ[SESSION_ID];
10402
10670
  if (!event_id) {
10403
- console.warn('event_id Cannot be empty');
10671
+ await func.utils.report_issue(SESSION_ID, {
10672
+ code: 'RUN_MSG_EVT_060',
10673
+ source: 'func.events.invoke',
10674
+ message: 'event_id Cannot be empty',
10675
+ type: 'W',
10676
+ });
10404
10677
  return false;
10405
10678
  }
10406
10679
  var ds;
@@ -10417,7 +10690,15 @@ func.events.invoke = async function (event_id) {
10417
10690
  }
10418
10691
 
10419
10692
  if (!ds) {
10420
- console.warn('event_id not found');
10693
+ await func.utils.report_issue(SESSION_ID, {
10694
+ code: 'RUN_MSG_EVT_060',
10695
+ source: 'func.events.invoke',
10696
+ message: 'event_id not found',
10697
+ type: 'W',
10698
+ details: {
10699
+ event_id,
10700
+ },
10701
+ });
10421
10702
  return false;
10422
10703
  }
10423
10704
 
@@ -11153,7 +11434,7 @@ func.expression.get_property = async function (valP) {
11153
11434
  });
11154
11435
  return await vm.run(val);
11155
11436
  } catch (err) {
11156
- throw '';
11437
+ throw err;
11157
11438
  }
11158
11439
  }
11159
11440
 
@@ -11362,11 +11643,23 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
11362
11643
  try {
11363
11644
  return eval(val);
11364
11645
  } catch (err) {
11646
+ if (sourceP === 'javascript' && !ignore_errors) {
11647
+ await func.utils.report_issue(SESSION_ID, {
11648
+ code: 'RUN_MSG_EXP_010',
11649
+ source: 'func.expression.secure_eval',
11650
+ message: 'Execution error',
11651
+ type: 'E',
11652
+ err,
11653
+ details: {
11654
+ sourceP,
11655
+ dsSessionP,
11656
+ job_id,
11657
+ },
11658
+ });
11659
+ }
11365
11660
  try {
11366
- if (sourceP === 'javascript' && !ignore_errors) console.error(err);
11367
11661
  return JSON5.parse(val);
11368
- } catch (err) {
11369
- if (sourceP === 'javascript' && !ignore_errors) console.error(err);
11662
+ } catch (json_error) {
11370
11663
  return val;
11371
11664
  }
11372
11665
  }
@@ -11383,13 +11676,22 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
11383
11676
  ...(sourceP === 'javascript' ? { axios, got, FormData } : {}),
11384
11677
  };
11385
11678
 
11386
- const handleError = (err) => {
11387
- console.error('Execution error:', err);
11679
+ const handleError = async (err) => {
11680
+ await func.utils.report_issue(SESSION_ID, {
11681
+ code: 'RUN_MSG_EXP_010',
11682
+ source: 'func.expression.secure_eval',
11683
+ message: 'Execution error',
11684
+ type: 'E',
11685
+ err,
11686
+ details: {
11687
+ sourceP,
11688
+ dsSessionP,
11689
+ job_id,
11690
+ },
11691
+ });
11388
11692
  func.events.delete_job(SESSION_ID, job_id);
11389
11693
  if (isServer && !SESSION_OBJ[SESSION_ID].crawler) {
11390
- if (sourceP === 'javascript') {
11391
- __.rpi.write_log(SESSION_OBJ[SESSION_ID].app_id, 'error', 'worker', 'vm error', err, null, val, 'func.expression.get.secure_eval');
11392
- } else {
11694
+ if (sourceP !== 'javascript') {
11393
11695
  __.db.add_error_log(SESSION_OBJ[SESSION_ID].app_id, 'api', err);
11394
11696
  }
11395
11697
  }
@@ -11397,10 +11699,12 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
11397
11699
  };
11398
11700
 
11399
11701
  if (sourceP === 'javascript') {
11400
- process.on('uncaughtException', handleError);
11702
+ process.on('uncaughtException', function (uncaught_error) {
11703
+ handleError(uncaught_error);
11704
+ });
11401
11705
  try {
11402
11706
  const dir = path.join(_conf.studio_drive_path, SESSION_OBJ[SESSION_ID].app_id, 'node_modules');
11403
- const script = new VMScript(`try { ${val} } catch (e) { func.api.error(SESSION_ID, "nodejs error", e); console.error(e); func.events.delete_job(SESSION_ID, "${job_id}"); }`, { filename: dir, dirname: dir });
11707
+ const script = new VMScript(`try { ${val} } catch (e) { func.api.error(SESSION_ID, "nodejs error", e); throw e; }`, { filename: dir, dirname: dir });
11404
11708
  const vm = new NodeVM({
11405
11709
  require: { external: true },
11406
11710
  sandbox,
@@ -11408,7 +11712,7 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
11408
11712
  });
11409
11713
  return await vm.run(script, { filename: dir, dirname: dir });
11410
11714
  } catch (err) {
11411
- return handleError(err);
11715
+ return await handleError(err);
11412
11716
  }
11413
11717
  }
11414
11718
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle",
3
- "version": "1.3.2698",
3
+ "version": "1.3.2700",
4
4
  "description": "xuda framework",
5
5
  "main": "index.js",
6
6
  "scripts": {