Problem
src/kyc/provider.rs contains 18 panic-prone calls (unwrap, expect, or panic!).
Evidence
src/kyc/provider.rs:199 — .expect("Failed to create HTTP client");
src/kyc/provider.rs:211 — .expect("Invalid key length");
src/kyc/provider.rs:259 — session_id: result["session_id"].as_str().unwrap().to_string(),
src/kyc/provider.rs:261 — expires_at: DateTime::parse_from_rfc3339(result["expires_at"].as_str().unwrap())
src/kyc/provider.rs:262 — .unwrap()
Proposed fix
Replace non-essential unwrap/expect usages with typed error propagation and contextual logging. Keep explicit panics only where unrecoverable invariants are well-documented.
Acceptance criteria
- All avoidable panic-prone calls in this file are removed or justified with comments/tests.
- Error paths return typed errors and preserve observability context.
- Existing tests pass (or new tests cover changed paths).
Problem
src/kyc/provider.rscontains 18 panic-prone calls (unwrap,expect, orpanic!).Evidence
src/kyc/provider.rs:199—.expect("Failed to create HTTP client");src/kyc/provider.rs:211—.expect("Invalid key length");src/kyc/provider.rs:259—session_id: result["session_id"].as_str().unwrap().to_string(),src/kyc/provider.rs:261—expires_at: DateTime::parse_from_rfc3339(result["expires_at"].as_str().unwrap())src/kyc/provider.rs:262—.unwrap()Proposed fix
Replace non-essential
unwrap/expectusages with typed error propagation and contextual logging. Keep explicit panics only where unrecoverable invariants are well-documented.Acceptance criteria