From 83aa71503f2da024b529b89d403f0477855496c8 Mon Sep 17 00:00:00 2001 From: Mia Bennett Date: Tue, 18 Jun 2024 15:04:40 +0930 Subject: [PATCH] fix(events): [PPT-1390] return 404 instead of 500 if the event can't be found upstream. --- src/controllers/events.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/events.cr b/src/controllers/events.cr index dc918f0..2cec9db 100644 --- a/src/controllers/events.cr +++ b/src/controllers/events.cr @@ -1076,8 +1076,9 @@ class Events < Application begin event = client.get_event(user.email, id: event_id, calendar_id: cal_id) rescue PlaceCalendar::Exception - raise Error::NotFound.new("failed to find event #{event_id} searching on #{cal_id} as #{user.email}") unless event + event = nil end + raise Error::NotFound.new("failed to find event #{event_id} searching on #{cal_id} as #{user.email}") unless event # User details user_email = tenant.service_account.try(&.downcase) || user.email.downcase