close
Skip to content

refactor(go): refactor go sdk errors#2159

Merged
spetz merged 15 commits into
apache:masterfrom
chengxilo:fix-iggy-error-go
Sep 27, 2025
Merged

refactor(go): refactor go sdk errors#2159
spetz merged 15 commits into
apache:masterfrom
chengxilo:fix-iggy-error-go

Conversation

@chengxilo
Copy link
Copy Markdown
Contributor

What I Did

  1. Aligned Error Codes and Information with the Rust SDK
  2. Refactored IggyError: Discarded Sentinel Errors, Introduced Code(err error) Helper.
  3. Updated Tests
  4. Removed the Logic for Ignoring xxxAlreadyExists Errors, as referenced in PR #604.

Rationale
Why Discard Sentinel Errors?
Iggy has hundreds of distinct error types, and maintaining a corresponding sentinel variable for each is a nightmare. Since we now standardize on using error codes, extracting them via the Code(err error) helper makes error handling much more scalable and maintainable.
For those who still prefer sentinel errors, I’ve also implemented an Is() function for error comparison, so users can create their own sentinel errors and use them with errors.Is() function.

Why Remove the Logic for Ignoring xxxAlreadyExists Errors?
I believe there’s no need to check for existence before attempting to create something. Instead, I can simply try to create it—if it already exists, the operation will return an error indicating so. I can then handle this error as needed, such as by returning, continuing, or applying other logic.
At least in Go, I don’t think such errors should be ignored by default, it's caller's job to handle it.

@chengxilo chengxilo marked this pull request as ready for review September 5, 2025 17:53
hubcio
hubcio previously approved these changes Sep 9, 2025
numinnex
numinnex previously approved these changes Sep 9, 2025
@chengxilo chengxilo marked this pull request as draft September 12, 2025 17:59
@chengxilo chengxilo marked this pull request as ready for review September 13, 2025 22:43
@spetz spetz merged commit 7b15508 into apache:master Sep 27, 2025
47 checks passed
hageshiame pushed a commit to hageshiame/iggy that referenced this pull request Nov 7, 2025
1. Aligned Error Codes and Information with the Rust SDK
2. Refactored IggyError: Discarded Sentinel Errors, Introduced Code(err
error) Helper.
3. Updated Tests
4. Removed the Logic for Ignoring xxxAlreadyExists Errors, as referenced in [PR apache#604](apache#604).
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.

5 participants