I want to know to what exception name I should refer to. I am getting invalid date. I checked the docs and I couldn't find it.
Begin
Date.new(day,month,year)
Rescue exceptionname
statements
I think you're looking for ArgumentError
. Using irb
:
> Date.new(2,-200, 3)
ArgumentError: invalid date
from (irb):11:in `new'
from (irb):11
so
begin
Date.new(2,-200, 3)
rescue ArgumentError
#your logic
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With