Created
January 25, 2020 16:38
-
-
Save piscisaureus/4db35c56062895386bf4210870431ab1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function try_import(url) { | |
let status; | |
try { | |
await import(url); | |
status = "OK"; | |
} catch (err) { | |
status = err.name; | |
} | |
status = status.padEnd(12); | |
return status + url; | |
} | |
async function main() { | |
const imports = [ | |
"./subdir/mod1.form_urlencoded.txt", | |
"./subdir/indirect_import_error.js", | |
"./subdir/mod2.ts", | |
"./subdir/json_1.json", | |
"./subdir/json_2.json", | |
"/just my imagination.js", | |
"./subdir/mod4.js", | |
"./subdir/mismatch_ext.ts", | |
"./subdir/throws.js", | |
"./subdir/indirect_throws.js", | |
"./symlink-to-dir", | |
"./subdir/indirect_import_error.js", | |
"./subdir/mod1.ts", | |
"ftp://deno.land/no_such_protocol.ts", | |
"https://raw.githubusercontent.com/denoland/deno/v0.0.1/package.json", | |
"./subdir/mod3.js", | |
"./subdir/mod5.mjs" | |
]; | |
let results = await Promise.all(imports.map(try_import)); | |
results.forEach(l => console.log(l)); | |
console.log("***DONE***"); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment