From 15ad57c48f27bebe38c6d377679f36e865fc3690 Mon Sep 17 00:00:00 2001 From: Greg Colombo Date: Fri, 15 Nov 2024 22:33:15 +0000 Subject: [PATCH] improve feature compiled out error --- bin/propolis-server/src/lib/spec/api_spec_v0.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/propolis-server/src/lib/spec/api_spec_v0.rs b/bin/propolis-server/src/lib/spec/api_spec_v0.rs index 006c454ba..1f88e7e11 100644 --- a/bin/propolis-server/src/lib/spec/api_spec_v0.rs +++ b/bin/propolis-server/src/lib/spec/api_spec_v0.rs @@ -44,8 +44,8 @@ pub(crate) enum ApiSpecError { NetworkBackendNotFound { backend: String, device: String }, #[allow(dead_code)] - #[error("support for component {0} compiled out")] - FeatureCompiledOut(String), + #[error("support for component {component} compiled out via {feature}")] + FeatureCompiledOut { component: String, feature: &'static str }, #[error("backend {0} not used by any device")] BackendNotUsed(String), @@ -308,7 +308,10 @@ impl TryFrom for Spec { } #[cfg(feature = "omicron-build")] ComponentV0::MigrationFailureInjector(_) => { - return Err(ApiSpecError::FeatureCompiledOut(device_name)); + return Err(ApiSpecError::FeatureCompiledOut { + component: device_name, + feature: "omicron-build", + }); } #[cfg(not(feature = "omicron-build"))] ComponentV0::MigrationFailureInjector(mig) => { @@ -322,7 +325,10 @@ impl TryFrom for Spec { | ComponentV0::SoftNpuPort(_) | ComponentV0::SoftNpuP9(_) | ComponentV0::P9fs(_) => { - return Err(ApiSpecError::FeatureCompiledOut(device_name)); + return Err(ApiSpecError::FeatureCompiledOut { + component: device_name, + feature: "falcon", + }); } #[cfg(feature = "falcon")] ComponentV0::SoftNpuPciPort(port) => {