Skip to content

Commit

Permalink
Merge pull request #2634 from itowlson/fix-reg-comp-invalid-semver-error
Browse files Browse the repository at this point in the history
Better error if component from registry has regrettable version
  • Loading branch information
itowlson authored Jul 14, 2024
2 parents 3d78173 + deb8f3c commit 66ede35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/loader/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl LocalLoader {
.take();

let source = self
.load_component_source(component.source.clone())
.load_component_source(id, component.source.clone())
.await
.with_context(|| format!("Failed to load Wasm source {}", component.source))?;

Expand Down Expand Up @@ -215,6 +215,7 @@ impl LocalLoader {
// URL with an absolute path to the content.
async fn load_component_source(
&self,
component_id: &KebabId,
source: v2::ComponentSource,
) -> Result<LockedComponentSource> {
let content = match source {
Expand All @@ -227,6 +228,7 @@ impl LocalLoader {
package,
version,
} => {
let version = semver::Version::parse(&version).with_context(|| format!("Component {component_id} specifies an invalid semantic version ({version:?}) for its package version"))?;
self.load_registry_source(registry.as_ref(), &package, &version)
.await?
}
Expand Down
2 changes: 1 addition & 1 deletion crates/manifest/src/schema/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub enum ComponentSource {
/// `package = "example:component"`
package: PackageRef,
/// `version = "1.2.3"`
version: semver::Version,
version: String,
},
}

Expand Down

0 comments on commit 66ede35

Please sign in to comment.