Skip to content

Commit

Permalink
Improve error messages from Daniels pr
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Jul 11, 2024
1 parent f429d33 commit 5b4e634
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions zk_toolbox/crates/config/src/ecosystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ impl EcosystemConfig {

pub fn from_file(shell: &Shell) -> Result<Self, EcosystemConfigFromFileError> {
let path = PathBuf::from(CONFIG_NAME);
if !shell.path_exists(path) {
return Err(EcosystemConfigFromFileError::NotExists);
if !shell.path_exists(&path) {
return Err(EcosystemConfigFromFileError::NotExists {
path: shell.current_dir(),
});
}

let mut config = EcosystemConfig::read(shell, CONFIG_NAME)
Expand Down Expand Up @@ -229,8 +231,9 @@ impl EcosystemConfig {
/// Result of checking if the ecosystem exists.
#[derive(Error, Debug)]
pub enum EcosystemConfigFromFileError {
#[error("Ecosystem configuration not found")]
NotExists,
#[error("Ecosystem configuration not found (Could not find 'ZkStack.toml' in {path:?}: Make sure you have created an ecosystem & are in the new folder `cd path/to/ecosystem/name`)"
)]
NotExists { path: PathBuf },
#[error("Invalid ecosystem configuration")]
InvalidConfig { source: anyhow::Error },
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn run(args: EcosystemCreateArgs, shell: &Shell) -> anyhow::Result<()> {
Err(EcosystemConfigFromFileError::InvalidConfig { .. }) => {
bail!(MSG_ECOSYSTEM_CONFIG_INVALID_ERR)
}
Err(EcosystemConfigFromFileError::NotExists) => create(args, shell)?,
Err(EcosystemConfigFromFileError::NotExists { .. }) => create(args, shell)?,
};

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion zk_toolbox/crates/zk_inception/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(super) const MSG_L1_NETWORK_PROMPT: &str = "Select the L1 network";
pub(super) const MSG_START_CONTAINERS_PROMPT: &str =
"Do you want to start containers after creating the ecosystem?";
pub(super) const MSG_CREATING_ECOSYSTEM: &str = "Creating ecosystem";
pub(super) const MSG_CREATED_ECOSYSTEM: &str = "Ecosystem created successfully";
pub(super) const MSG_CREATED_ECOSYSTEM: &str = "Ecosystem created successfully (All subsequent commands should be executed from ecosystem folder `cd path/to/ecosystem/name`)";
pub(super) const MSG_CLONING_ERA_REPO_SPINNER: &str = "Cloning zksync-era repository...";
pub(super) const MSG_CREATING_INITIAL_CONFIGURATIONS_SPINNER: &str =
"Creating initial configurations...";
Expand Down

0 comments on commit 5b4e634

Please sign in to comment.