how to exception for invalid date ruby

ruby

Solution

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

Problem

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 ```

Original source