Improved error handling.

This commit is contained in:
Martin Edenhofer 2013-04-18 01:45:23 +02:00
parent 8ec3f8acec
commit 0b26b5cdd5

View file

@ -65,16 +65,18 @@ module Session
session_file = @path + '/' + client_id.to_s + '/session' session_file = @path + '/' + client_id.to_s + '/session'
data = nil data = nil
return if !File.exist? session_file return if !File.exist? session_file
begin
File.open( session_file, 'rb' ) { |file| File.open( session_file, 'rb' ) { |file|
file.flock( File::LOCK_EX ) file.flock( File::LOCK_EX )
all = file.read all = file.read
file.flock( File::LOCK_UN ) file.flock( File::LOCK_UN )
begin
data = Marshal.load( all ) data = Marshal.load( all )
rescue }
rescue Exception => e
puts "Error reading '#{session_file}':"
puts e.inspect
return return
end end
}
return data return data
end end