(Proposal) Error explanations #170
Labels
api
This has to do with the Python API (view)
discussion
General discussion about something view.py related
good first issue
An issue that isn't necessarily easy to implement, but not required to be an expert in view.py
Content:
Marking this as "Good First Issue" to allow people new to the project to weigh in on this. This is a discussion, not a decided feature yet! For those coming from outside of view.py, this could be a chance to learn about feature proposals for any project, not just view.py.
Rationale
Errors can be pretty ambiguous, especially in libraries. view.py does its best to provide descriptive errors, but it just might not make any sense to someone totally new to the project, and since view.py's codebase is so large already, there are a lot of different errors you can get. This library is still relatively new, so googling errors doesn't really work either (which might cause some to be driven away from view.py)
For example, imagine you see
InvalidTemplateError: unknown key "foo" in <view> tag
. In context, that might make perfect sense, but to a user, that could be pretty cryptic. Perhaps view.py could integrate an error and explanation system (similar to whatrustc --explain
does). This would take quite a bit of work, so I'm making this discussion first to see if that would make things easier on users.Proposal
All classes derived from
ViewError
(which is every exception in view.py) will take a requiredcode
parameter. For example,VE1000
. Then, similar to the hint system (see #120), an explanation of what to do could follow the error message (or alternatively, give a command that would explain it). This could make debugging much nicer to especially new users. Following the example above, this would look something like:Followed by:
The downside of this is that each explanation would have to be more or less hardcoded into view.py, which could drastically increase the size of the package (we're talking several extra mB, and thousands of lines of just error explanations).
Talking Points
The text was updated successfully, but these errors were encountered: