Hammertime:Ruby交互错误控制

Hammertime是由Avdi Grimm创建的一个Ruby交互错误控制台,它的角色类似于Ruby-debug

Hammertime目前只支持Ruby 1.8.x 。使用它仅需要使用简单的gem安装,并且请求类库即可:

require 'hammertime'

当一个错误出现时,将会出现一个菜单:

=== Stop! Hammertime. ===
An error has occurred at example.rb:6:in `faulty_method'
The error is: #<RuntimeError : Oh no!>
1. Continue (process the exception normally)            
2. Ignore (proceed without raising an exception)        
3. Permit by type (don't ask about future errors of this type)
4. Permit by line (don't ask about future errors raised from this point)
5. Backtrace (show the call stack leading up to the error)              
6. Debug (start a debugger)                                             
7. Console (start an IRB session)

可以完全不修改原来的代码,直接用它来测试代码文件:

ruby -rhammertime test.rb

它和rdebug的有区别是可以在异常处启动。

Monitor Your Web Site 24/7 - Receive email and SMS alerts anytime your web site goes down.

Related Posts

Leave a Reply

Monitor Your Web Site 24/7 - Receive email and SMS alerts anytime your web site goes down.

About Me

About Me
Record Technical Articles at Gooss.org.

Entries (RSS) and Comments (RSS). Valid XHTML and CSS and XFN.

© Copyright 2009 山海经. All rights reserved.

Social Bookmarks

Copyright © Designed by: Free WP Templates
Food Charts |  About Breast Milk |  Organic Food