raggi / exception_string

A clean ruby exception formatter that resembles the interpreters native output

Home Page:http://github.com/raggi/exception_string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exception_string

by James Tucker
http://ra66i.org
http://github.com/raggi/exception_string

DESCRIPTION:

Provides clean exception formatting as a string, which resembles native output formats for back-traces that kill the interpreter. Whilst there are shorter, simpler ways to format ruby exceptions, this format is almost as short, but provides the format that young ruby programmers will be familiar with, and can be used to keep logs and output data consistent with other areas of the platform.

At present the only provided format is that which is generated by MRI 1.8.x.

FEATURES/PROBLEMS:

  • Supports MRI (ruby 1.8.x) style exception formats

  • Kinda a big package, for 3 LoC.

  • Should probably be part of the platform.

SYNOPSIS:

Something like:

...

begin
  raise "boom"
rescue => e
  puts e.to_s_mri
end

...

Outputs something like:

boomtest.rb:18:in `go': boom (RuntimeError)
  from boomtest.rb:34:in `foo'
  from boomtest.rb:36

REQUIREMENTS:

  • Ruby!

  • bacon for the spec suite

INSTALL:

  • gem install exception_string

TODO:

  • Add other interpreter exception formats, if there are any variances.

LICENSE:

(The MIT License)

Copyright © 2008 James Tucker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A clean ruby exception formatter that resembles the interpreters native output

http://github.com/raggi/exception_string


Languages

Language:Ruby 100.0%