| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
10年前发布

Ruby 异常格式化输出:PrettyBacktrace

PrettyBacktrace 项目用于对 Ruby 的异常堆栈进行格式化显示,示例代码:

require 'pretty_backtrace'  PrettyBacktrace.enable     def recursive n    str = "Hi #{n}!!  " * 128    if n > 0      recursive n - 1    else      raise "bottom of recursive"    end  end     recursive 3

格式化效果:

test.rb:10:in `recursive' (n = 0, str = "Hi 0!!  Hi 0!!  Hi 0...): bottom of recursive (RuntimeError)
        from test.rb:9:in `recursive' (n = 1, str = "Hi 1!!  Hi 1!!  Hi 1...)
        from test.rb:9:in `recursive' (n = 2, str = "Hi 2!!  Hi 2!!  Hi 2...)
        from test.rb:9:in `recursive' (n = 3, str = "Hi 3!!  Hi 3!!  Hi 3...)
        from test.rb:15:in `<main>'

项目主页:http://www.open-open.com/lib/view/home/1423662383498

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1423662383498.html
Ruby开发 PrettyBacktrace