Closed gr8bit closed 3 years ago
Parsing an empty string leads to NoMethodError instead of ArgumentError (when using do_parse) or nil (when using parse).
do_parse
nil
parse
require 'fugit' Fugit::Cron.parse(' ') => nil Fugit::Cron.parse(nil) => nil Fugit::Cron.parse('') Traceback (most recent call last): 1: from (irb):20 NoMethodError (undefined method `subgather' for nil:NilClass)
Empty string should parse as invalid cron string, just like " " or nil.
" "
Linux 242fdceb1492 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux] [:env_tz, nil] (secs:1606866124.7550213,utc~:"2020-12-01 23:42:04.755021333694458",ltz~:"UTC") (etz:nil,tnz:"UTC",tziv:"1.2.8",tzidv:nil,rv:"2.6.6",rp:"x86_64-linux",win:false,rorv:nil,astz:nil,eov:"1.2.4",eotnz:#<TZInfo::TimezoneProxy: Etc/UCT>,eotnfz:"+0000",eotlzn:"Etc/UCT",eotnfZ:"UTC",debian:"/UTC",centos:nil,osx:"/UTC") "1.4.1"
I'm using Fugit in Rails context.
Thanks for reporting this!
I think I fixed it. Please tell me if not.
Issue description
Parsing an empty string leads to NoMethodError instead of ArgumentError (when using
do_parse
) ornil
(when usingparse
).How to reproduce
Expected behaviour
Empty string should parse as invalid cron string, just like
" "
ornil
.Context
Additional context
I'm using Fugit in Rails context.