Skip to content

refactor: change DataStore::get_note_script to return Option<NoteScript>#2069

Merged
partylikeits1983 merged 3 commits intonextfrom
ajl-refactor-datastore
Nov 7, 2025
Merged

refactor: change DataStore::get_note_script to return Option<NoteScript>#2069
partylikeits1983 merged 3 commits intonextfrom
ajl-refactor-datastore

Conversation

@partylikeits1983
Copy link
Contributor

This PR resolves: #2029

Follow up PR to #1995

This PR changes the DataStore::get_note_script API to return Result<Option<NoteScript>, DataStoreError>
instead of Result<NoteScript, DataStoreError>. This makes the distinction between "script not found" (represented by Ok(None)) and "error retrieving data" (represented by Err) explicit.

Benefits:

  • Clearer intent: The API signature explicitly communicates that "not found" is a valid, expected outcome
  • Simpler error handling: Consumers can use ? to propagate internal errors while handling None separately
  • Better separation of concerns: Distinguishes between "data not present" and "error retrieving data"
  • Follows Rust idioms where Option represents presence/absence and Result represents success/failure

@partylikeits1983 partylikeits1983 self-assigned this Nov 6, 2025
@partylikeits1983 partylikeits1983 added no changelog This PR does not require an entry in the `CHANGELOG.md` file rust Issues that affect or pull requests that update Rust code labels Nov 6, 2025
@partylikeits1983 partylikeits1983 marked this pull request as ready for review November 6, 2025 13:12
@partylikeits1983 partylikeits1983 changed the title refactor: change DataStore::get_note_script to return Option<NoteScript> refactor: change DataStore::get_note_script to return Option<NoteScript> Nov 6, 2025
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@partylikeits1983 partylikeits1983 merged commit e6d333d into next Nov 7, 2025
17 checks passed
@partylikeits1983 partylikeits1983 deleted the ajl-refactor-datastore branch November 7, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file rust Issues that affect or pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve DataStore::get_note_script API

4 participants