Skip to content

Conversation

@rozbb
Copy link
Contributor

@rozbb rozbb commented Oct 29, 2025

This PR upstreams the fix in cloudflare/azul#148 . The issue in that code base was that an error value from Storage::get was interpreted as a missing key regardless of what the error was. This turned out to be a huge footgun.

This PR changes the type signature to get(key: &str) -> Result<Option<T>>, returning Ok(None) when the key is not defined. This lets the caller distinguish between missing keys and proper errors.

@guybedford
Copy link
Collaborator

CI fix in #860, which I'll land now, then this can be based to that.

@guybedford guybedford merged commit bb70059 into cloudflare:main Oct 29, 2025
6 checks passed
@rozbb rozbb changed the title Implement Storage::get_maybe. Deprecate Storage::get Make Storage::get specify when the return value is not defined Oct 30, 2025
@rozbb rozbb changed the title Make Storage::get specify when the return value is not defined Make Storage::get specify when the requested key doesn't exist Oct 30, 2025
@rozbb rozbb deleted the do-storage-get-maybe branch October 31, 2025 03:20
@guybedford guybedford changed the title Make Storage::get specify when the requested key doesn't exist Make Storage::get return an option Nov 25, 2025
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.

2 participants