Use rescue StandardError for stream close
## Motivation and Context Replace bare `rescue` with explicit `rescue StandardError` in stream cleanup to clarify intent, with a comment explaining why. In Ruby, `rescue` without an exception class is equivalent to `rescue StandardError`, so this is a readability improvement with no behavior change. ## How Has This Been Tested? Existing tests pass. ## Breaking Changes None.
This commit is contained in:
parent
6669601b5d
commit
d3f400f525
1 changed files with 4 additions and 4 deletions
|
|
@ -150,8 +150,8 @@ module MCP
|
||||||
# removed from `@sessions` above, so other threads will not find them
|
# removed from `@sessions` above, so other threads will not find them
|
||||||
# and will not attempt to close the same stream.
|
# and will not attempt to close the same stream.
|
||||||
stream.close
|
stream.close
|
||||||
rescue
|
rescue StandardError
|
||||||
nil
|
# Ignore close-related errors from already closed/broken streams.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -239,8 +239,8 @@ module MCP
|
||||||
|
|
||||||
begin
|
begin
|
||||||
session[:stream]&.close
|
session[:stream]&.close
|
||||||
rescue
|
rescue StandardError
|
||||||
nil
|
# Ignore close-related errors from already closed/broken streams.
|
||||||
end
|
end
|
||||||
@sessions.delete(session_id)
|
@sessions.delete(session_id)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue