Method: ContentServer.handle_program_termination

Defined in:
lib/content_server/server.rb

.handle_program_termination(exception) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/content_server/server.rb', line 37

def handle_program_termination(exception)
  #Write exception message to console
  message = "\nInterrupt or Exit happened in server:''.\n" +
    "Exception type:'#{exception.class}'.\n" +
    "Exception message:'#{exception.message}'.\n" +
    "Stopping process.\n" +
    "Backtrace:\n#{exception.backtrace.join("\n")}"
  puts(message)

  # Block force write to file resolving Issue 217 https://github.com/bbfsdev/bbfs/issues/217
  # force write content data to file
  #if $local_content_data
   # puts("\nForce writing local content data to #{Params['local_content_data_path']}.")
    #$local_content_data.to_file($tmp_content_data_file)
    #File.rename($tmp_content_data_file, Params['local_content_data_path'])
  #end

  #Write exception message to log and mail(if enabled)
  Log.error(message)
end