diff options
author | Toshiaki Asai <toshi.alternative@gmail.com> | 2014-05-13 20:48:17 +0900 |
---|---|---|
committer | Toshiaki Asai <toshi.alternative@gmail.com> | 2014-05-13 20:48:17 +0900 |
commit | f513798b628cfa3927a8af02ff7247e822259b9f (patch) | |
tree | 39d63338b3c322461b92ce3cdf8c7cc605623a5d /mikutter.rb | |
parent | 20503a11aa22b381cb10affff3b0ac165881a0f3 (diff) | |
download | mikutter-f513798b628cfa3927a8af02ff7247e822259b9f.tar.gz |
Gtk関係の場所でクラッシュした時にバックトレースが表示されていなかった
Diffstat (limited to 'mikutter.rb')
-rwxr-xr-x | mikutter.rb | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/mikutter.rb b/mikutter.rb index 3adcb902..42b7d6ef 100755 --- a/mikutter.rb +++ b/mikutter.rb @@ -43,31 +43,32 @@ Plugin.call(:boot, Post.primary_service) # イベントの待受を開始する。 # _profile_ がtrueなら、プロファイリングした結果を一時ディレクトリに保存する def boot!(profile) - Mainloop.before_mainloop - if profile - require 'ruby-prof' - begin - notice 'start profiling' - RubyProf.start - Mainloop.mainloop - ensure - result = RubyProf.stop - printer = RubyProf::CallTreePrinter.new(result) - profile_out = File.join(File.expand_path(Environment::TMPDIR), 'profile-'+Time.new.strftime('%Y-%m-%d-%H%M%S')+'.out') - notice "profile: writing to #{profile_out}" - printer.print(File.open(profile_out, 'w'), {}) - notice "profile: done." - end - else - Mainloop.mainloop end -rescue => e - into_debug_mode(e) - raise e -rescue Exception => e - e = Mainloop.exception_filter(e) - notice e.class - raise e -end + begin + Mainloop.before_mainloop + if profile + require 'ruby-prof' + begin + notice 'start profiling' + RubyProf.start + Mainloop.mainloop + ensure + result = RubyProf.stop + printer = RubyProf::CallTreePrinter.new(result) + profile_out = File.join(File.expand_path(Environment::TMPDIR), 'profile-'+Time.new.strftime('%Y-%m-%d-%H%M%S')+'.out') + notice "profile: writing to #{profile_out}" + printer.print(File.open(profile_out, 'w'), {}) + notice "profile: done." + end + else + Mainloop.mainloop end + rescue => exception + into_debug_mode(exception) + raise exception + rescue Exception => exception + exception = Mainloop.exception_filter(exception) + raise exception end + exception = Mainloop.exception_filter(nil) + raise exception if exception end begin errfile = File.join(File.expand_path(Environment::TMPDIR), 'mikutter_dump') |