Skip to content

Commit

Permalink
Land #263, ensure EOFError is raised
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 authored Mar 20, 2024
2 parents 0611a3e + aa9ed6e commit fa81d23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/ruby_smb/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,9 @@ def recv_packet(encrypt: false)
raw_response = dispatcher.recv_packet
rescue RubySMB::Error::CommunicationError => e
if encrypt
raise RubySMB::Error::EncryptionError, "Communication error with the "\
"remote host: #{e.message}. The server supports encryption but was "\
"not able to handle the encrypted request."
raise e, "Communication error with the "\
"remote host: #{e.message}. The server supports encryption and this error "\
"may have been caused by encryption issues, but not always."
else
raise e
end
Expand Down
5 changes: 2 additions & 3 deletions spec/lib/ruby_smb/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@
it 'raises an EncryptionError exception if an error occurs while receiving the response' do
allow(dispatcher).to receive(:recv_packet).and_raise(RubySMB::Error::CommunicationError)
expect { client.recv_packet(encrypt: true) }.to raise_error(
RubySMB::Error::EncryptionError,
RubySMB::Error::CommunicationError,
'Communication error with the remote host: RubySMB::Error::CommunicationError. '\
'The server supports encryption but was not able to handle the encrypted request.'
'The server supports encryption and this error may have been caused by encryption issues, but not always.'
)
end

Expand Down Expand Up @@ -2853,4 +2853,3 @@
end
end
end

0 comments on commit fa81d23

Please sign in to comment.