fix(storage):make init_store return Result#448
Conversation
Greptile SummaryThis is the first step of migrating
Confidence Score: 4/5Safe to merge — the change is a minimal signature update with no behavioral difference today. The only change is wrapping the return value in No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/storage/src/store.rs | Changes init_store signature from -> Self to -> Result<Self, Error> and wraps the return in Ok(...). Both callers (from_anchor_state, get_forkchoice_store) now unwrap via .expect(). Minor: a stray leading space in the get_forkchoice_store expect message. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
crates/storage/src/store.rs:536
There is a leading space in the panic message — `" store initialization..."` — that differs from the message used in `from_anchor_state`.
```suggestion
.expect("store initialization should succeed in get_forkchoice_store"),
```
Reviews (1): Last reviewed commit: "make init_store return Result" | Re-trigger Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
MegaRedHand
left a comment
There was a problem hiding this comment.
LGTM. Left a comment regarding future direction
| mut anchor_state: State, | ||
| anchor_body: Option<BlockBody>, | ||
| ) -> Self { | ||
| ) -> Result<Self, Error> { |
There was a problem hiding this comment.
Just a heads-up, but we probably need some other crate::error::Error enum for this, which wraps this crate::api::Error.
🗒️ Description / Motivation
First step of migrating
Storefunctions to returnResultinstead of panicking.Changes
init_storeto returnResult<Self, Error>, wrapping the return value inOk(...). All existing.expect()calls inside the function body are left as-is for now, error propagation will come in follow-up PRs.Related Issues / PRs
.expect(), propagate Result through storage layer #306✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleancargo test --workspace --release— all passing