summaryrefslogtreecommitdiff
path: root/tests/error_014_catch_dynamic_import_error.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/error_014_catch_dynamic_import_error.js')
-rw-r--r--tests/error_014_catch_dynamic_import_error.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/error_014_catch_dynamic_import_error.js b/tests/error_014_catch_dynamic_import_error.js
new file mode 100644
index 000000000..ad3735fc3
--- /dev/null
+++ b/tests/error_014_catch_dynamic_import_error.js
@@ -0,0 +1,31 @@
+(async () => {
+ try {
+ await import("does not exist");
+ } catch (err) {
+ console.log("Caught direct dynamic import error.");
+ console.log(err);
+ }
+
+ try {
+ await import("./subdir/indirect_import_error.js");
+ } catch (err) {
+ console.log("Caught indirect direct dynamic import error.");
+ console.log(err);
+ }
+
+ try {
+ await import("./subdir/throws.js");
+ } catch (err) {
+ console.log("Caught error thrown by dynamically imported module.");
+ console.log(err);
+ }
+
+ try {
+ await import("./subdir/indirect_throws.js");
+ } catch (err) {
+ console.log(
+ "Caught error thrown indirectly by dynamically imported module."
+ );
+ console.log(err);
+ }
+})();