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

error code #'s #6386

Closed
vtjnash opened this issue Apr 3, 2014 · 9 comments
Closed

error code #'s #6386

vtjnash opened this issue Apr 3, 2014 · 9 comments
Labels
domain:docs This change adds or pertains to documentation kind:speculative Whether the change will be implemented is speculative status:help wanted Indicates that a maintainer wants help on an issue or pull request

Comments

@vtjnash
Copy link
Sponsor Member

vtjnash commented Apr 3, 2014

Proposal: add error codes to all julia internal error messages which can be cross-referenced against an extended documentation page that describes each error, giving more verbose descriptions, examples, gotchas, and solutions

@JeffBezanson
Copy link
Sponsor Member

Improving error messages and even adding doc links is great, but assigning unique codes to each just strikes me as a tedious and unnecessary burden. Error messages that are very tricky should just be longer and more descriptive.

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 3, 2014

i wanted to use the codes as a way of reducing the tedium of making doc links. perhaps the text itself is enough to cross-reference to the docs, but what if you wanted to update the text?

while writing twitter-worthy error messages sounds like a great goal, i'm pretty bad at it. writing a paragraph (with the added benefit of having room for examples) seemed like a worthwhile tradeoff.

how would we go about this? lookup table in showerror that adds a hyperlink? hyperlink to where, RTD?

@jiahao
Copy link
Member

jiahao commented Apr 3, 2014

Not orthogonal to #5694 and related error reporting issues like #4744, #4836, etc.

It will be particularly challenging to implement this proposal for a centralized table of error codes when the errors are thrown by underlying libraries like LAPACKException and ARPACKException, since the error codes encapsulated are context-sensitive and mean different things depending on the specific external procedure that threw the error to begin with. Not to mention that ARPACK's documentation is not exactly a paragon of clarity about its own error codes...

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 3, 2014

Ultimately I agree we will have to bite the bullet and remove error in favor of throwing specific exception types. -- Jeff, in #5694

I guess this would effectively assign unique codes to each error type

@JeffBezanson
Copy link
Sponsor Member

Uh, that's not the same as assigning a numeric code to every error.

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 3, 2014

a type pointer is sort of like a unique numeric code, no?

@JeffBezanson
Copy link
Sponsor Member

But there isn't a different type for every error message; you group the errors into a reasonable number of exception types. See for example python's exception hierarchy.

Further distinguishing errors is not what I'm against; here I'm really just against the idea of numeric codes specifically. Everything in a computer is numbers underneath, so that's clearly not what I'm talking about.

@tknopp
Copy link
Contributor

tknopp commented Apr 3, 2014

I am also for a better exception hierarchy instead of error codes. This is how it works in Java and C# and it actually works quite well to localize bugs. I have seen C code that did arithmetics on error codes (to look if the error is in a certain range) and this was just scary...

@ScottPJones
Copy link
Contributor

Hmm... I know this was closed a year ago, but there is an argument for using error codes (not necessarily centralized error codes) that was not raised... the ability to have locale specific messages.
I am all for a better exception hierarchy, but using sets of error codes (best set up with Enums, not integers), possibly one set for each exception type, can work very well, and avoids the idea that everything has to be English...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation kind:speculative Whether the change will be implemented is speculative status:help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

5 participants