-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
RFC: Improved error messages #4794
Conversation
@@ -160,7 +160,7 @@ function squeeze(A::AbstractArray, dims) | |||
for i in 1:ndims(A) | |||
if in(i,dims) | |||
if size(A,i) != 1 | |||
error("squeezed dims must all be size 1") | |||
error("Squeezed dims must all be size 1,") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ,
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was experimenting with making the messages more grammatically consistent
with the backtrace that follows.
On Wed, Nov 13, 2013 at 2:41 AM, Ivar Nesje [email protected]:
In base/abstractarray.jl:
@@ -160,7 +160,7 @@ function squeeze(A::AbstractArray, dims)
for i in 1:ndims(A)
if in(i,dims)
if size(A,i) != 1
error("squeezed dims must all be size 1")
error("Squeezed dims must all be size 1,")
Why ,
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/4794/files#r7619890
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the punctation should be left to the error formatting apparatus, but I wanted to start small.
+1 for this effort. I occasionally still scratch my head over some error messages. |
Conflicts: base/bitarray.jl
I don't like the trailing commas at all. We also don't need to add function names to every error message, since they are printed in the backtrace. |
@JeffBezanson This PR removes function names from error messages. |
That's odd; maybe the diff I saw was getting rendered wrong or something like that. Anyway the commas are bad; there should not be any "required formatting" inside error messages or we are bound to forget it in some cases. A message should just describe the problem with no further ceremony. The code that presents error messages can take care of adding newlines etc. as necessary. |
If it's just a question of fixing up details, should this be reopened? |
I'm working on removing the commas from this patch. On Thu, Nov 14, 2013 at 2:43 PM, Tim Holy [email protected] wrote:
|
I took a crack at improving more error messages. I also tweaked the formatting of them a bit. Now only the error message and the affected functions are red. Everything else is the normal color. This helps the important information stand out.
Still outstanding is the exception handling. Right now, exception messages are not being handled consistently, and it would take more extensive changes to make that happen, so I didn't touch them.
Let me know if this is the right direction.
See #4762 and #4744