Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List errors which might be raised in function docstrings #53

Closed
dicej opened this issue Jan 10, 2024 · 0 comments · Fixed by #55
Closed

List errors which might be raised in function docstrings #53

dicej opened this issue Jan 10, 2024 · 0 comments · Fixed by #55

Comments

@dicej
Copy link
Collaborator

dicej commented Jan 10, 2024

Python does not currently have a way to represent the types of errors/exceptions which might be raised by a function in a typed function signature, so the next best thing is to list them in the docstring (e.g. following any docs derived from WIT doc comments).

dicej added a commit that referenced this issue Jan 12, 2024
If the WIT representation of a function returns `result<A,B>`, then we generate
a Python function that returns `A` and raises `Err(B)`.  Since there's currently
no way of representing the `Err(B)` part in the function's signature, we do the
next best thing: put it in the docstring.

Fixes #53

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej added a commit that referenced this issue Jan 12, 2024
If the WIT representation of a function returns `result<A,B>`, then we generate
a Python function that returns `A` and raises `Err(B)`.  Since there's currently
no way of representing the `Err(B)` part in the function's signature, we do the
next best thing: put it in the docstring.

Fixes #53

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej added a commit that referenced this issue Jan 12, 2024
If the WIT representation of a function returns `result<A,B>`, then we generate
a Python function that returns `A` and raises `Err(B)`.  Since there's currently
no way of representing the `Err(B)` part in the function's signature, we do the
next best thing: put it in the docstring.

Fixes #53

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej closed this as completed in #55 Jan 12, 2024
dicej added a commit that referenced this issue Jan 12, 2024
If the WIT representation of a function returns `result<A,B>`, then we generate
a Python function that returns `A` and raises `Err(B)`.  Since there's currently
no way of representing the `Err(B)` part in the function's signature, we do the
next best thing: put it in the docstring.

Fixes #53

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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 a pull request may close this issue.

1 participant