Skip to content

Commit

Permalink
Correct error-raising logic (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
gshutler authored Jul 8, 2024
1 parent 69cbf57 commit 6833cc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/ews/types/calendar_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/ews/types/calendar_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/ews/types/tasks_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6833cc6

Please sign in to comment.