@@ -7,6 +7,7 @@ import 'dart:convert';
7
7
import 'dart:js_util' ;
8
8
import 'dart:typed_data' ;
9
9
10
+ import 'package:cli_pkg/js.dart' ;
10
11
import 'package:node_interop/js.dart' ;
11
12
import 'package:path/path.dart' as p;
12
13
@@ -217,7 +218,8 @@ List<AsyncCallable> _parseFunctions(RenderOptions options, DateTime start,
217
218
scheduleMicrotask (() => currentFiber.run (result));
218
219
})
219
220
];
220
- var result = (callback as JSFunction ).apply (context, jsArguments);
221
+ var result = wrapJSExceptions (
222
+ () => (callback as JSFunction ).apply (context, jsArguments));
221
223
return unwrapValue (isUndefined (result)
222
224
// Run `fiber.yield()` in runZoned() so that Dart resets the current
223
225
// zone once it's done. Otherwise, interweaving fibers can leave
@@ -228,8 +230,9 @@ List<AsyncCallable> _parseFunctions(RenderOptions options, DateTime start,
228
230
} else if (! asynch) {
229
231
result.add (Callable .fromSignature (
230
232
signature.trimLeft (),
231
- (arguments) => unwrapValue ((callback as JSFunction )
232
- .apply (context, arguments.map (wrapValue).toList ())),
233
+ (arguments) => unwrapValue (wrapJSExceptions (() =>
234
+ (callback as JSFunction )
235
+ .apply (context, arguments.map (wrapValue).toList ()))),
233
236
requireParens: false ));
234
237
} else {
235
238
result.add (
@@ -239,7 +242,8 @@ List<AsyncCallable> _parseFunctions(RenderOptions options, DateTime start,
239
242
...arguments.map (wrapValue),
240
243
allowInterop (([Object ? result]) => completer.complete (result))
241
244
];
242
- var result = (callback as JSFunction ).apply (context, jsArguments);
245
+ var result = wrapJSExceptions (
246
+ () => (callback as JSFunction ).apply (context, jsArguments));
243
247
return unwrapValue (
244
248
isUndefined (result) ? await completer.future : result);
245
249
}, requireParens: false ));
0 commit comments