apache / apache/iggy

Expose structured `IggyError` in Python

Open
#3,618 2 comments 0 reactions 1 assignee Claimed by @mmmmxa View on GitHub
good first issue python
Dominant language
Rust
Stars
4.9k
Forks
432
Avg merge
2d 10h
Merged PRs (30d)
173

Description

### Description

Python currently exposes Iggy failures as plain `RuntimeError` or `ValueError` with only a message. It should expose one `apache_iggy.IggyError` for all Iggy-specific failures, with `code`, a stable snake_case `name`, and a human-readable `message`.

### Affected area / component

Python SDK

### Proposed solution

- Add `apache_iggy.IggyError`.
- Use it for Rust `IggyError` values and current Iggy-specific validation failures.
- Set `code = as_code()`, `name = as_string()`, `message = to_string()`.
- `name` is the stable snake_case identifier.
- `message` is the human-readable error text.
- Keep `str(error) == error.message`.
- Replace ad hoc `PyRuntimeError` and `PyValueError` mappings with one helper.
- Update the stub, tests, and Python docs.
- Place this code in `foreign/python/src/error.rs`.

### Alternatives considered

_No response_

### Contribution

- [ ] I'm willing to submit a pull request to implement this feature

### Good first issue

- [x] I think this could be a good first issue for a new contributor

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.