Browse Source

cli: improve cli metadata missing error (#1819)

Paul 3 years ago
parent
commit
269200b3b8
1 changed files with 6 additions and 3 deletions
  1. 6 3
      cli/src/lib.rs

+ 6 - 3
cli/src/lib.rs

@@ -2139,9 +2139,12 @@ fn stream_logs(config: &WithPath<Config>, rpc_url: &str) -> Result<Vec<std::proc
         let mut contents = vec![];
         file.read_to_end(&mut contents)?;
         let idl: Idl = serde_json::from_slice(&contents)?;
-        let metadata = idl
-            .metadata
-            .ok_or_else(|| anyhow!("Program address not found."))?;
+        let metadata = idl.metadata.ok_or_else(|| {
+            anyhow!(
+                "Metadata property not found in IDL of program: {}",
+                program.lib_name
+            )
+        })?;
         let metadata: IdlTestMetadata = serde_json::from_value(metadata)?;
 
         let log_file = File::create(format!(