Project

General

Profile

Bug #2829

Missing documentation for Exception subclasses.

Added by marcandre (Marc-Andre Lafortune) over 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2dev (2010-03-02 trunk 26792) [x86_64-darwin10.2.0]
Backport:
[ruby-core:28394]

Description

=begin
I noticed that the documentation for Exception subclasses are either that of Exception itself, or just plain non-sensical because they are actually missing (see ZeroDivisionError, FiberError, ...)

It would be preferable if the Exception classes were at least briefly described.

I've made a first draft of a description for all Exception subclasses, and would encourage anyone interested in improving it by editing the wiki:

http://redmine.ruby-lang.org/wiki/ruby/ExceptionClassesDoc

Thanks.
=end

History

#1

Updated by mame (Yusuke Endoh) over 9 years ago

  • Assignee set to marcandre (Marc-Andre Lafortune)

=begin
Hi,

I've made a first draft of a description for all Exception subclasses, and would encourage anyone interested in improving it by editing the wiki:

http://redmine.ruby-lang.org/wiki/ruby/ExceptionClassesDoc

Outstanding work!

My comments:

NotImplementedError
Raised when a method is not implemented on the current platform.

I prefer "feature" to "method", because some method is actually
defined but NotImplementedError may be raised depending on the
argument (e.g., Process.uid=).

SyntaxError
Raised when attempting to parse Ruby code with an invalid syntax.

I could be paranoid, but SyntaxError may be raised in compile
phase. So "execute" would be better than "parse".

LocalJumpError
Raised when attempting to return out of a context that no longer exists.

There is simpler situation: no block given (yield).
Attempting to return across Threads will also raise LocalJumpError.

def foo
Thread.new { return }.join
end
foo

But I don't have better concrete explanation. Sorry.

NameError
Raised when a given name is invalid (e.g. a constant's name can not be "my_constant" since it must start with a capital letter)

It will also be raised when referring undefined (uninitialized)
local variable.

undefined local variable or method `foo' for main:Object (NameError)

Anyway, I agree with importing them.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#2

Updated by marcandre (Marc-Andre Lafortune) about 9 years ago

=begin
Hi Yusuke.

Thanks for these comments. I've updated the wiki accordingly. I've also added examples to most exception classes.

Unless there is objection, I plan on changing the following error messages:

[1, 2].fetch(-3)
From: index -1 out of array
To: index -3 outside of array bounds: -2...2

{}.fetch("foo")
From: key not found
To: key not found: "foo"

I will also commit the changes documentation unless there are further comments.

--
Marc-André
=end

#3

Updated by marcandre (Marc-Andre Lafortune) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27670.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF