Skip to content

#3 Result-based error handling#39

Merged
dexwritescode merged 1 commit into
mainfrom
result-error-handling
Apr 22, 2026
Merged

#3 Result-based error handling#39
dexwritescode merged 1 commit into
mainfrom
result-error-handling

Conversation

@dexwritescode
Copy link
Copy Markdown
Owner

Summary

  • New error.rsActionError enum with variants: MissingEnv, InvalidStrategy, InvalidTag, Unauthorized, ApiError, UnexpectedStatus
  • config.rs — all env-reading helpers return Result; Config::new() returns Result<Config, ActionError>; Default impl removed; exit(1) gone
  • releases.rsget_latest_release and create_release return Result<Option<TagName>, ActionError>; lifetime annotation corrected
  • main.rsrun() -> Result<(), ActionError> contains all logic; main() is the single site for eprintln! + exit(1)
  • README — dropped ?branch=main from badge URL (fixes stale badge)

This is the prerequisite for #4 (unit tests for config and releases).

Test plan

  • cargo test — 6 tests, all green

🤖 Generated with Claude Code

- Add error.rs with ActionError enum (MissingEnv, InvalidStrategy,
  InvalidTag, Unauthorized, ApiError, UnexpectedStatus)
- config.rs: all helpers return Result; Config::new() returns
  Result<Config, ActionError>; remove Default impl
- releases.rs: get_latest_release and create_release return
  Result<Option<TagName>, ActionError>; fix lifetime annotation
- main.rs: run() -> Result bubbles errors up; main() has the single
  eprintln + exit(1)
- README: drop ?branch=main from badge URL so it reflects latest run

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dexwritescode dexwritescode merged commit 660116a into main Apr 22, 2026
2 checks passed
@dexwritescode dexwritescode deleted the result-error-handling branch April 22, 2026 16:44
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.

1 participant