summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mattermost/session.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb
index d14121c91a0..f4629585da7 100644
--- a/lib/mattermost/session.rb
+++ b/lib/mattermost/session.rb
@@ -28,10 +28,12 @@ module Mattermost
def with_session
raise NoSessionError unless create
- result = yield
- destroy
- result
+ begin
+ yield
+ ensure
+ destroy
+ end
end
# Next methods are needed for Doorkeeper