summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-11-15 05:11:42 -0500
committerRyan Dahl <ry@tinyclouds.org>2018-11-16 08:05:13 +0800
commitd7abdfe754b1e95c71e0f1956c3e9a1448fa9df1 (patch)
treef347fe3140d668188f32811578424af2857791d5
parent3c8d2bde685d015721b1c0fd6f2a3ae54c156583 (diff)
Simplify NotFound code.
-rw-r--r--src/deno_dir.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/deno_dir.rs b/src/deno_dir.rs
index cbc25fd63..ee114a654 100644
--- a/src/deno_dir.rs
+++ b/src/deno_dir.rs
@@ -1,6 +1,6 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
use dirs;
-use errors::DenoError;
+use errors;
use errors::DenoResult;
use errors::ErrorKind;
use fs as deno_fs;
@@ -208,7 +208,7 @@ impl DenoDir {
self: &Self,
module_specifier: &str,
containing_file: &str,
- ) -> Result<CodeFetchOutput, DenoError> {
+ ) -> Result<CodeFetchOutput, errors::DenoError> {
debug!(
"code_fetch. module_specifier {} containing_file {}",
module_specifier, containing_file
@@ -219,21 +219,21 @@ impl DenoDir {
let result = self.get_source_code(module_name.as_str(), filename.as_str());
let out = match result {
+ Ok(out) => out,
Err(err) => {
if err.kind() == ErrorKind::NotFound {
// For NotFound, change the message to something better.
- return Err(DenoError::from(std::io::Error::new(
- std::io::ErrorKind::NotFound,
+ return Err(errors::new(
+ ErrorKind::NotFound,
format!(
"Cannot resolve module \"{}\" from \"{}\"",
module_specifier, containing_file
),
- )));
+ ));
} else {
return Err(err);
}
- }
- Ok(out) => out,
+ },
};
let result =