# Annotated Exception (a la Ruby Treasures)

**URL:** <https://www.ruby-forum.com/t/annotated-exception-a-la-ruby-treasures/95316>\
**Category:** Ruby\
**Created:** [May 28, 2006, 1:15am UTC](https://www.ruby-forum.com/t/annotated-exception-a-la-ruby-treasures/95316 "2006-05-28T01:15:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 28, 2006, 1:15am UTC](https://www.ruby-forum.com/t/annotated-exception-a-la-ruby-treasures/95316/1 "2006-05-28T01:15:50Z")

</div>

Anyone remember Ruby Treasures? Well I was browsing thru some old Ruby  
Treasures code (written by Paul B. BTW) and I came across a couple  
implementations for adding annotations to Exceptions. These worked by  
wrapping special blocks around a raise call. The syntax of those  
implemenations didn’t come off well though, but I started wondering if  
something like that would be useful if it were part of the ‘begin’ call  
instead. Eg.

def foo  
begin ‘playing with Ruby’  
# . . .  
begin ‘doing some silly things’  
# . . .  
raise RuntimeError  
end  
end  
end

Resulting in somthing like:

=\> test.rb:7 RuntimeError: RuntimeError  
began – doing some silly things  
began – playing with Ruby  
from test.rb:2:in `foo’  
from test.rb:2

Just a thought,

T.
