From e505fa45eded7a1a15c8362350e878688c229d5f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 2 Oct 2017 16:59:40 +0200 Subject: Try to get better info if config can't be parsed. --- lib/registration.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/registration.rb b/lib/registration.rb index bfcf903..4f2db17 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -32,8 +32,15 @@ def create_pdf_file_name(band) filename = "#{Date.today.iso8601}-#{sanitize(band.name)}-#{sanitize(band.city)}.pdf" end +def parse_date(str) + Date.parse(str) +rescue TypeError => e + $stderr << "Invalid date specified: " << str + raise +end + def accept_registrations(settings) - start_date = Date.parse(settings.accept_registrations[:start]) - end_date = Date.parse(settings.accept_registrations[:stop]) + start_date = parse_date(settings.accept_registrations[:start]) + end_date = parse_date(settings.accept_registrations[:stop]) start_date <= Date.today && end_date > Date.today end -- cgit v1.2.3