Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleymichal committed Mar 3, 2020
1 parent 2b12d06 commit 8fc76a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/commands/kv/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn directory_keys_values(
Ok(_file_type) => {
// any other file types (files, symlinks)
// TODO: return an error type here, like NotADirectoryError
Err(format_err!("site.bucket must be a directory"))
Err(format_err!("Check your wrangler.toml; the `bucket` attribute for [site] should point to a directory."))
}
Err(e) => Err(format_err!("{}", e)),
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn publish(

if let Some(site_config) = &target.site {
let path = &site_config.bucket.clone();
assert_non_root_bucket(path)?;
validate_bucket_location(path)?;
warn_site_incompatible_route(&deploy_config);
let site_namespace = add_site_namespace(user, target, false)?;

Expand Down Expand Up @@ -106,12 +106,12 @@ pub fn add_site_namespace(

// We don't want folks setting their bucket to the top level directory,
// which is where wrangler commands are always called from.
pub fn assert_non_root_bucket(bucket: &PathBuf) -> Result<(), failure::Error> {
pub fn validate_bucket_location(bucket: &PathBuf) -> Result<(), failure::Error> {
// TODO: this should really use a convenience function for "Wrangler Project Root"
let current_dir = env::current_dir()?;
if bucket.as_os_str() == current_dir {
failure::bail!(
"{} You need to specify a bucket directory in your wrangler.toml",
"{} Your bucket cannot be set to the parent directory of your wrangler.toml",
emoji::WARN
)
}
Expand Down

0 comments on commit 8fc76a7

Please sign in to comment.