diff --git a/lib/ews/types/calendar_folder.rb b/lib/ews/types/calendar_folder.rb index 0bf11ce1..a3b80e26 100644 --- a/lib/ews/types/calendar_folder.rb +++ b/lib/ews/types/calendar_folder.rb @@ -55,7 +55,11 @@ def create_item(attributes, to_ews_create_opts = {}) if rm && rm.success? CalendarItem.new ews, rm.items.first[:calendar_item][:elems].first else - raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm + if rm + raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" + else + raise EwsCreateItemError, "Could not create item in folder." + end end end diff --git a/lib/ews/types/calendar_item.rb b/lib/ews/types/calendar_item.rb index be81144a..5369441e 100644 --- a/lib/ews/types/calendar_item.rb +++ b/lib/ews/types/calendar_item.rb @@ -111,7 +111,11 @@ def update_item!(updates, options = {}) self.get_all_properties! self else - raise EwsCreateItemError, "Could not update calendar item. #{rm.code}: #{rm.message_text}" unless rm + if rm + raise EwsCreateItemError, "Could not update calendar item. #{rm.code}: #{rm.message_text}" + else + raise EwsCreateItemError, "Could not update calendar item." + end end end diff --git a/lib/ews/types/tasks_folder.rb b/lib/ews/types/tasks_folder.rb index 7228972b..ecbe1148 100644 --- a/lib/ews/types/tasks_folder.rb +++ b/lib/ews/types/tasks_folder.rb @@ -20,7 +20,11 @@ def create_item(attributes) if rm && rm.success? Task.new ews, rm.items.first[:task][:elems].first else - raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm + if rm + raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" + else + raise EwsCreateItemError, "Could not create item in folder." + end end end end