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

Better error messages [1-40,41] #9

Open
philtweir opened this issue Apr 13, 2024 · 0 comments · Fixed by #15
Open

Better error messages [1-40,41] #9

philtweir opened this issue Apr 13, 2024 · 0 comments · Fixed by #15
Labels

Comments

@philtweir
Copy link
Contributor

philtweir commented Apr 13, 2024

id: 1-39], [MAJOR]: Executing the example fails with the error message

File "C:\Users\...dewret\src\dewret\workflow.py", line 322,
in add_step
raise TypeError(f"All tasks should have a type annotation.")
TypeError: All tasks should have a type annotation.
That's because increment misses a return type.

[id: 1-40], [MAJOR]: The initial error stack does not contain the line of the task causing the error
(at least I didn't see it). Instead, it guides to a (from the user's perspective) non-existing line ("line
322"). For the given example, this is not a big issue/easy to spot, of course. But in general this is
an issue.

[id: 1-41], [MODERATE], [ENH]: The initial error message is fine, however, maybe a more precise
hint and/or more information would be nice. For example/some proposals:

  1. The error message could contain the task name (and module), i.e. for example TypeError: Task 'increment' misses complete type annotation.
  2. The error message could be more precise with respect what type annotation misses, i.e. for
    example: TypeError: Task 'increment' misses type annotations for: 'return type', parameter 'foo', 'parameter bar'.
  3. The error message could (in addition) give a proper example:
`TypeError: Task 'increment' has no or incomplete type annotations.
Example for a valid task:
@task()
def add_one(num: int) -> int:
    return num + 1
@philtweir philtweir linked a pull request Apr 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant