Skip to content

Commit 4f55eba

Browse files
committed
[model-gateway] wasm: replace unwarp with error handling (sgl-project#12471)
Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
1 parent 057aa21 commit 4f55eba

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sgl-router/src/app_context.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl AppContextBuilder {
282282
.with_workflow_engine()
283283
.with_mcp_manager(&router_config)
284284
.await?
285-
.with_wasm_manager(&router_config)
285+
.with_wasm_manager(&router_config)?
286286
.router_config(router_config))
287287
}
288288

@@ -518,15 +518,16 @@ impl AppContextBuilder {
518518
}
519519

520520
/// Create wasm manager if enabled in config
521-
fn with_wasm_manager(mut self, config: &RouterConfig) -> Self {
521+
fn with_wasm_manager(mut self, config: &RouterConfig) -> Result<Self, String> {
522522
self.wasm_manager = if config.enable_wasm {
523523
Some(Arc::new(
524-
WasmModuleManager::new(WasmRuntimeConfig::default()).unwrap(),
524+
WasmModuleManager::new(WasmRuntimeConfig::default())
525+
.map_err(|e| format!("Failed to initialize WASM module manager: {}", e))?,
525526
))
526527
} else {
527528
None
528529
};
529-
self
530+
Ok(self)
530531
}
531532
}
532533

0 commit comments

Comments
 (0)