@oneuptime/common 12.0.11 → 12.0.12

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.
@@ -165,6 +165,15 @@ export default class IfElse extends ComponentCode {
165
165
  options.log(msg);
166
166
  });
167
167
 
168
+ /*
169
+ * runCodeInSandbox resolves with `scriptError` when the expression
170
+ * threw or timed out — it no longer rejects. Fail the run instead of
171
+ * silently taking the "No" branch.
172
+ */
173
+ if (returnResult.scriptError) {
174
+ throw returnResult.scriptError;
175
+ }
176
+
168
177
  if (returnResult.returnValue) {
169
178
  return {
170
179
  returnValues: {},
@@ -81,6 +81,15 @@ export default class JavaScriptCode extends ComponentCode {
81
81
  options.log(msg);
82
82
  });
83
83
 
84
+ /*
85
+ * runCodeInSandbox resolves with `scriptError` when the user script
86
+ * threw or timed out — it no longer rejects. Route those runs to the
87
+ * error port, matching the pre-sandbox behavior.
88
+ */
89
+ if (returnResult.scriptError) {
90
+ throw returnResult.scriptError;
91
+ }
92
+
84
93
  const returnVal: JSONValue = returnResult.returnValue;
85
94
 
86
95
  return {
@@ -636,6 +636,18 @@ ${contextBlock}
636
636
  return null;
637
637
  }
638
638
 
639
+ /*
640
+ * runCodeInSandbox resolves with `scriptError` when the expression threw
641
+ * or timed out — it no longer rejects. Keep the pre-sandbox outcome
642
+ * (criteria not met) but retain the error log.
643
+ */
644
+ if (result.scriptError) {
645
+ logger.error(result.scriptError, {
646
+ projectId: input.monitor.projectId?.toString(),
647
+ });
648
+ return null;
649
+ }
650
+
639
651
  if (result && result.returnValue) {
640
652
  return `JavaScript Expression - ${expression} - evaluated to true.`;
641
653
  }