Skip to content

Conversation

flying-sheep
Copy link
Collaborator

@flying-sheep flying-sheep commented Sep 25, 2025

I’d like to improve thrown errors. Ideally our tests would make sure that

  • specifying some invalid index in __getitem__ always raises IndexError
  • some invalid type passed to a parameter raises TypeError
  • some invalid value of the correct type being passed to a parameter raises ValueError
  • only resource errors or other things users have no direct control over raise RuntimeErrors

For this, I think .map_py_err should be the more common API that we use on known error types that we can cleanly map to Python error types, and .map_py_err_from_str is the (intentionally more verbose) variant inline mapping of

  1. rare error types
  2. instances of known errors that get raises in a context where they indicate something else happened, e.g. an error that would normally be an IndexError occurs due to some runtime issue and should become a RuntimeError in that case (like a catch-and-reraise)

@flying-sheep flying-sheep marked this pull request as draft September 25, 2025 08:14
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