Project

General

Profile

Actions

Misc #11295

open

Request for comments about error messages

Added by ko1 (Koichi Sasada) over 8 years ago. Updated over 8 years ago.

Status:
Open
Assignee:
-
[ruby-core:69708]

Description

(This is not a proposal, bug reports)

Ruby shows error messages when something wrong.

There are several proposals to extend error messages.

And some requests.

  • Reverse backtrace and show error messages at the bottom (to avoid scroll up terminal)
  • Translation error messages to other languages

If you have any idea, please tell us.
We can consider about Ruby's error message APIs to realize your ideas.
(I can't guarantee we can implement your ideas :p)

Updated by normalperson (Eric Wong) over 8 years ago

wrote:

There are several proposals to extend error messages.

What performance and memory usage impact do these have?
I run many small scripts and already find startup times slow.

  • Reverse backtrace and show error messages at the bottom (to avoid
    scroll up terminal)

We should reduce stack size limit instead to avoid big backtraces ;)

Jokes aside, this may be confusing and break compatibility because of
existing tools which process backtraces (perhaps generic and not limited
to Ruby).

  • Translation error messages to other languages

NACK. This makes searching for users with similar problems more
difficult and makes error messages difficult for maintainers to
decipher.

Updated by robb (Robb Shecter) over 8 years ago

Thanks for starting this discussion!

And some requests.

  • Reverse backtrace and show error messages at the bottom (to avoid scroll up terminal)

+1 for this. It's how Python displays backtraces. That's a good precedent to follow. I find that senior devs (like myself) and brand new developers (like my students) often have problems determining the exact error when seeing a backtrace. The current output isn't very user friendly: it makes the most common use case difficult, instead of making it easy: "A programmer wants to know what error responsible for the crash."

Updated by robb (Robb Shecter) over 8 years ago

Koichi Sasada wrote:

If you have any idea, please tell us.
We can consider about Ruby's error message APIs to realize your ideas.
(I can't guarantee we can implement your ideas :p)

Again, thanks for posting this.

I believe that some small changes can make Ruby error messages more helpful. E.g., I've just begun working on a Pull Request to change the rb_eArgError messages from e.g. "2 for 3" to "2 were expected, but 3 were given." Or even, "2 were expected, but 3 were given: <arg1.class>, <arg2.class>, <arg3.class>."

This change would greatly increase the usefulness and friendlyness of the interpreter, for relatively little work.

Updated by robb (Robb Shecter) over 8 years ago

See also "Clarify the error message when calling a method with the wrong number of arguments", https://bugs.ruby-lang.org/issues/9025

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0