ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:72641] [Ruby trunk - Feature #11935] [Open] Date.new returns inconsistent errors when passed invalid arguments
       [not found] <redmine.issue-11935.20151231180334@ruby-lang.org>
@ 2015-12-31 18:03 ` chris
  2016-01-11 17:08 ` [ruby-core:72808] [Ruby trunk - Feature #11935] " chris
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: chris @ 2015-12-31 18:03 UTC (permalink / raw
  To: ruby-core

Issue #11935 has been reported by Christopher Kinniburgh.

----------------------------------------
Feature #11935: Date.new returns inconsistent errors when passed invalid arguments
https://bugs.ruby-lang.org/issues/11935

* Author: Christopher Kinniburgh
* Status: Open
* Priority: Normal
* Assignee: tadayoshi funaba
----------------------------------------
When passed invalid data, such as floats and nil values, the Date.new function returns a variety of results that aren't particularly easy to 

~~~
irb(main):002:0> Date.new(1,nil,1)
TypeError: no implicit conversion from nil to integer
irb(main):003:0> Date.new(1,1,nil)
NoMethodError: undefined method `div' for nil:NilClass
irb(main):004:0> Date.new(nil,1,1)
NoMethodError: undefined method `<' for nil:NilClass
~~~

I have attached a potential fix.  It returns a more consistent set of "invalid day", "invalid month", and "invalid year" argument errors.

---Files--------------------------------
date-new-argument-errors.patch (1.14 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:72808] [Ruby trunk - Feature #11935] Date.new returns inconsistent errors when passed invalid arguments
       [not found] <redmine.issue-11935.20151231180334@ruby-lang.org>
  2015-12-31 18:03 ` [ruby-core:72641] [Ruby trunk - Feature #11935] [Open] Date.new returns inconsistent errors when passed invalid arguments chris
@ 2016-01-11 17:08 ` chris
  2016-01-27 16:41 ` [ruby-core:73544] [Ruby trunk - Bug " chris
  2019-07-24 15:17 ` [ruby-core:93903] [Ruby master Bug#11935] " merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: chris @ 2016-01-11 17:08 UTC (permalink / raw
  To: ruby-core

Issue #11935 has been updated by Christopher Kinniburgh.

Description updated

----------------------------------------
Feature #11935: Date.new returns inconsistent errors when passed invalid arguments
https://bugs.ruby-lang.org/issues/11935#change-56050

* Author: Christopher Kinniburgh
* Status: Open
* Priority: Normal
* Assignee: tadayoshi funaba
----------------------------------------
When passed invalid data, such as floats and nil values, the Date.new function returns a variety of results that aren't particularly easy to read and understand.  The 'undefined method 'div' for nil:NilClass' is particularly unhelpful.

~~~
irb(main):002:0> Date.new(1,nil,1)
TypeError: no implicit conversion from nil to integer
irb(main):003:0> Date.new(1,1,nil)
NoMethodError: undefined method `div' for nil:NilClass
irb(main):004:0> Date.new(nil,1,1)
NoMethodError: undefined method `<' for nil:NilClass
~~~

I have attached a potential fix.  It returns a more consistent set of "invalid day", "invalid month", and "invalid year" argument errors.

---Files--------------------------------
date-new-argument-errors.patch (1.14 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:73544] [Ruby trunk - Bug #11935] Date.new returns inconsistent errors when passed invalid arguments
       [not found] <redmine.issue-11935.20151231180334@ruby-lang.org>
  2015-12-31 18:03 ` [ruby-core:72641] [Ruby trunk - Feature #11935] [Open] Date.new returns inconsistent errors when passed invalid arguments chris
  2016-01-11 17:08 ` [ruby-core:72808] [Ruby trunk - Feature #11935] " chris
@ 2016-01-27 16:41 ` chris
  2019-07-24 15:17 ` [ruby-core:93903] [Ruby master Bug#11935] " merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: chris @ 2016-01-27 16:41 UTC (permalink / raw
  To: ruby-core

Issue #11935 has been updated by Christopher Kinniburgh.

Tracker changed from Feature to Bug
Assignee changed from tadayoshi funaba to Yukihiro Matsumoto
ruby -v set to 2.4.0dev
Backport set to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN

Tadayoshi Funaba appears to have been gone for a year, so it's unclear who this should be assigned to.

----------------------------------------
Bug #11935: Date.new returns inconsistent errors when passed invalid arguments
https://bugs.ruby-lang.org/issues/11935#change-56756

* Author: Christopher Kinniburgh
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: 2.4.0dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
When passed invalid data, such as floats and nil values, the Date.new function returns a variety of results that aren't particularly easy to read and understand.  The 'undefined method 'div' for nil:NilClass' is particularly unhelpful.

~~~
irb(main):002:0> Date.new(1,nil,1)
TypeError: no implicit conversion from nil to integer
irb(main):003:0> Date.new(1,1,nil)
NoMethodError: undefined method `div' for nil:NilClass
irb(main):004:0> Date.new(nil,1,1)
NoMethodError: undefined method `<' for nil:NilClass
~~~

I have attached a potential fix.  It returns a more consistent set of "invalid day", "invalid month", and "invalid year" argument errors.

---Files--------------------------------
date-new-argument-errors.patch (1.14 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:93903] [Ruby master Bug#11935] Date.new returns inconsistent errors when passed invalid arguments
       [not found] <redmine.issue-11935.20151231180334@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2016-01-27 16:41 ` [ruby-core:73544] [Ruby trunk - Bug " chris
@ 2019-07-24 15:17 ` merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: merch-redmine @ 2019-07-24 15:17 UTC (permalink / raw
  To: ruby-core

Issue #11935 has been updated by jeremyevans0 (Jeremy Evans).

Assignee deleted (matz (Yukihiro Matsumoto))

I agree that we should make these errors consistent and have submitted a pull request to do so: https://github.com/ruby/date/pull/9

----------------------------------------
Bug #11935: Date.new returns inconsistent errors when passed invalid arguments
https://bugs.ruby-lang.org/issues/11935#change-79949

* Author: CJKinni (Christopher Kinniburgh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
When passed invalid data, such as floats and nil values, the Date.new function returns a variety of results that aren't particularly easy to read and understand.  The 'undefined method 'div' for nil:NilClass' is particularly unhelpful.

~~~
irb(main):002:0> Date.new(1,nil,1)
TypeError: no implicit conversion from nil to integer
irb(main):003:0> Date.new(1,1,nil)
NoMethodError: undefined method `div' for nil:NilClass
irb(main):004:0> Date.new(nil,1,1)
NoMethodError: undefined method `<' for nil:NilClass
~~~

I have attached a potential fix.  It returns a more consistent set of "invalid day", "invalid month", and "invalid year" argument errors.

---Files--------------------------------
date-new-argument-errors.patch (1.14 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-24 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-11935.20151231180334@ruby-lang.org>
2015-12-31 18:03 ` [ruby-core:72641] [Ruby trunk - Feature #11935] [Open] Date.new returns inconsistent errors when passed invalid arguments chris
2016-01-11 17:08 ` [ruby-core:72808] [Ruby trunk - Feature #11935] " chris
2016-01-27 16:41 ` [ruby-core:73544] [Ruby trunk - Bug " chris
2019-07-24 15:17 ` [ruby-core:93903] [Ruby master Bug#11935] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).