rileytb / ruby_file_filter

Media filter
0 stars 0 forks source link

begin/rescue implementation #5

Open rileytb opened 7 years ago

rileytb commented 7 years ago

https://github.com/rileytb/ruby_file_filter/blob/4c07bd0bbcd1d7fdffe341be3bb6e3d3a26c8289/filter.rb#L170

rileytb commented 7 years ago

begin
  # Exceptions raised by this code will
  # be caught by the following rescue clause
  while data = socket.read(512)
    opFile.write(data)
  end

rescue SystemCallError
  $stderr.print "IO failed: " + $!
  opFile.close
  File.delete(opName)
  raise
end