diff options
Diffstat (limited to 'cli/http_util.rs')
-rw-r--r-- | cli/http_util.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cli/http_util.rs b/cli/http_util.rs index 521acadfa..1a2aaf0d5 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -1,6 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use crate::auth_tokens::AuthToken; +use deno_core::error::custom_error; use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::url::Url; @@ -123,11 +124,18 @@ pub async fn fetch_once( if response.status().is_client_error() || response.status().is_server_error() { - let err = generic_error(format!( - "Import '{}' failed: {}", - args.url, - response.status() - )); + let err = if response.status() == StatusCode::NOT_FOUND { + custom_error( + "NotFound", + format!("Import '{}' failed, not found.", args.url), + ) + } else { + generic_error(format!( + "Import '{}' failed: {}", + args.url, + response.status() + )) + }; return Err(err); } |