diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-08-15 23:36:48 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-21 15:37:45 -0400 |
commit | 18d495c7d17cf3fce3835e732094d058f51eddaa (patch) | |
tree | f7244cfd83dbff9d8aaf67203feb0f3a24fe95f3 /js/unit_tests.ts | |
parent | cb1393cdaea4bfbee69efbf7ce86a4adfc4593b3 (diff) |
Better error handling in src/handlers.rs
Introduces error codes that are shared between JS/RS
Fixes #526.
Diffstat (limited to 'js/unit_tests.ts')
-rw-r--r-- | js/unit_tests.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/unit_tests.ts b/js/unit_tests.ts index 96341b4a2..ef65519f6 100644 --- a/js/unit_tests.ts +++ b/js/unit_tests.ts @@ -92,6 +92,21 @@ test(async function tests_readFileSync() { assertEqual(pkg.name, "deno"); }); +/* TODO We should be able to catch specific types. +test(function tests_readFileSync_NotFound() { + let caughtError = false; + let data; + try { + data = readFileSync("bad_filename"); + } catch (e) { + caughtError = true; + assert(e instanceof deno.NotFound); + } + assert(caughtError); + assert(data === undefined); +}); +*/ + test(async function tests_fetch() { const response = await fetch("http://localhost:4545/package.json"); const json = await response.json(); |