Project

General

Profile

Actions

Feature #5221

closed

LoadEerror#path

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

Status:
Closed
Target version:
[ruby-core:39079]

Description

I read a part of activesupport and they add a method LoadError#path to return unloaded file name (*1).

*1: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/load_error.rb

How about to add this method on trunk?

This is a patch with some re-factoring around LoadError:
http://www.atdot.net/sp/view/y5xeql/readonly?lang=diff


Files

noname (500 Bytes) noname tenderlovemaking (Aaron Patterson), 08/26/2011 02:53 AM
loaderror.patch (3.99 KB) loaderror.patch tenderlovemaking (Aaron Patterson), 02/25/2012 04:39 AM

Updated by drbrain (Eric Hodel) over 12 years ago

RubyGems parses the exception message to determine the filename so having LoadError#path would make things easier.

Should we be able to raise a LoadError from ruby with #path set too?

Like:

raise LoadError.new("no such file -- #{path}", path)

Updated by tenderlovemaking (Aaron Patterson) over 12 years ago

On Wed, Aug 24, 2011 at 12:28:50PM +0900, Koichi Sasada wrote:

Issue #5221 has been reported by Koichi Sasada.


Feature #5221: LoadEerror#path
http://redmine.ruby-lang.org/issues/5221

Author: Koichi Sasada
Status: Open
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 1.9.4

I read a part of activesupport and they add a method LoadError#path to return unloaded file name (*1).

*1: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/load_error.rb

How about to add this method on trunk?

This is a patch with some re-factoring around LoadError:
http://www.atdot.net/sp/view/y5xeql/readonly?lang=diff

Can we make it use a regular ivar for path rather than an ivar with no
"@"? Using private ivars like this makes life hard for doing
introspection (like the introspection required for YAML to dump / load).

Like this: https://gist.github.com/1171267

--
Aaron Patterson
http://tenderlovemaking.com/

Updated by tenderlovemaking (Aaron Patterson) about 12 years ago

Bump. Any news on this?

Updated by tenderlovemaking (Aaron Patterson) about 12 years ago

  • Target version changed from 1.9.4 to 2.0.0

Updated by tenderlovemaking (Aaron Patterson) about 12 years ago

I've reduced the diff slightly. May I commit this?

Updated by ko1 (Koichi Sasada) about 12 years ago

(2011/08/26 2:45), Aaron Patterson wrote:

Can we make it use a regular ivar for path rather than an ivar with no
"@"? Using private ivars like this makes life hard for doing
introspection (like the introspection required for YAML to dump / load).

I don't have any objection. Matz, what do you think about it?

--
// SASADA Koichi at atdot dot net

Updated by tenderlovemaking (Aaron Patterson) about 12 years ago

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

Applied in r34938

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0