Skip to content

cli: replace ctx.unwrap() with proper CliError on missing context#1671

Open
SAY-5 wants to merge 1 commit into
mofa-org:mainfrom
SAY-5:say5/cli-no-unwrap-1668
Open

cli: replace ctx.unwrap() with proper CliError on missing context#1671
SAY-5 wants to merge 1 commit into
mofa-org:mainfrom
SAY-5:say5/cli-no-unwrap-1668

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #1668.

Replaces the four ctx.as_ref().unwrap() calls in mofa-cli/src/main.rs (lines 169, 252, 299, 328) with a guarded ok_or_else that returns CliError::InitError and a clear, actionable message ("CLI context not initialized; run mofa init first or check that backend services are reachable") instead of a runtime panic. Aligns with the project's CLAUDE.md rule against unwrap() in production.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG:Replace .unwrap() Calls with Proper Error Handling in CLI

1 participant