Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/mongo/error/session_ended.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class Error
# Session was previously ended.
#
# @since 2.7.0
class SessionEnded < Error
class SessionEnded < InvalidSession
def initialize
super("The session was ended and cannot be used")
super('The session was ended and cannot be used. Please create a new session.')
end
end
end
Expand Down
7 changes: 1 addition & 6 deletions lib/mongo/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,6 @@ def session_id
'of the client owning this operation. Please only use this session for operations through its parent ' +
'client.'.freeze

# Error message describing that the session cannot be used because it has already been ended.
#
# @since 2.5.0
SESSION_ENDED_ERROR_MSG = 'This session has ended and cannot be used. Please create a new one.'.freeze

# Error message describing that sessions are not supported by the server version.
#
# @since 2.5.0
Expand Down Expand Up @@ -1251,7 +1246,7 @@ def set_operation_time(result)
end

def check_if_ended!
raise Mongo::Error::InvalidSession.new(SESSION_ENDED_ERROR_MSG) if ended?
raise Mongo::Error::SessionEnded if ended?
end

def check_matching_cluster!(client)
Expand Down
Loading