diff --git a/wit_embedder/src/extracter.rs b/wit_embedder/src/extracter.rs index feb394f7..09713331 100644 --- a/wit_embedder/src/extracter.rs +++ b/wit_embedder/src/extracter.rs @@ -1,3 +1,4 @@ +use crate::custom::WIT_SECTION_NAME; use std::path::PathBuf; use walrus::{IdsToIndices, ModuleConfig}; @@ -9,14 +10,14 @@ pub fn extract_wit(wasm_file: PathBuf) -> Result { let sections = module .customs .iter() - .filter(|(_, section)| section.name() == "interface-types") + .filter(|(_, section)| section.name() == WIT_SECTION_NAME) .collect::>(); if sections.is_empty() { - return Err("Wasm binary doesn't contain interface types section".to_string()); + return Err(format!("Wasm binary doesn't contain {} section", WIT_SECTION_NAME)); } if sections.len() > 1 { - return Err("Wasm binary contains more than one interface-types section".to_string()); + return Err(format!("Wasm binary contains more than one {} section", WIT_SECTION_NAME)); } let default_ids = IdsToIndices::default();