daily pastebin goal
48%
SHARE
TWEET

altered Hime backtrace script

Jatopian Mar 2nd, 2017 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. # ** Main
  3. #------------------------------------------------------------------------------
  4. #  This processing is executed after module and class definition is finished.
  5. #==============================================================================
  6.  
  7. begin
  8.   rgss_main { SceneManager.run } # This line replaces several, and is the only alteration.
  9. rescue SystemExit
  10.   exit
  11. rescue Exception => error
  12.   scripts_name = load_data('Data/Scripts.rvdata2')
  13.   scripts_name.collect! {|script|  script[1]  }
  14.   backtrace = []
  15.   error.backtrace.each_with_index {|line,i|
  16.     if line =~ /{(.*)}(.*)/
  17.       backtrace << (scripts_name[$1.to_i] + $2)
  18.     elsif line.start_with?(':1:')
  19.       break
  20.     else
  21.       backtrace << line
  22.     end
  23.   }
  24.   error_line = backtrace.first
  25.   error_msg = "%s: %s, %s" %[error_line, error.message, error.class]
  26.   backtrace[0] = ''
  27.    
  28.   File.open("error_log.txt", "w") do |f|
  29.     f.write(error_msg)
  30.     f.write(backtrace.join("\n\tfrom "))
  31.   end
  32.  
  33.   print error_msg, backtrace.join("\n\tfrom "), "\n"
  34.   raise  error.class, "Error ocurred, check the debug console for more information.", [error.backtrace.first]
  35. end
RAW Paste Data
Top