# Caller usage and getting a full trace after a rescue on general Exception

**URL:** <https://www.ruby-forum.com/t/caller-usage-and-getting-a-full-trace-after-a-rescue-on-general-exception/171282>\
**Category:** Ruby\
**Created:** [June 30, 2009, 12:39am UTC](https://www.ruby-forum.com/t/caller-usage-and-getting-a-full-trace-after-a-rescue-on-general-exception/171282 "2009-06-30T00:39:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 30, 2009, 12:39am UTC](https://www.ruby-forum.com/t/caller-usage-and-getting-a-full-trace-after-a-rescue-on-general-exception/171282/1 "2009-06-30T00:39:30Z")

</div>

Say, I’m having a difficult problem getting a complete trace/stack dump.  
I’ve  
got a place where I do a rescue Exception for anything, and I get the  
darn raise  
string, but not a trace back to the line where it occurred. In fact it  
appears  
my use of rescue is hiding the information I might get otherwise. Can  
someone  
give me some suggestions. My apologies if this should be obvious.

Sincerely, Xeno

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 30, 2009, 12:53am UTC](https://www.ruby-forum.com/t/caller-usage-and-getting-a-full-trace-after-a-rescue-on-general-exception/171282/2 "2009-06-30T00:53:32Z")

</div>

On Tue, Jun 30, 2009 at 07:38:22AM +0900, Xeno C. wrote:

> Say, I’m having a difficult problem getting a complete trace/stack dump.  
> I’ve got a place where I do a rescue Exception for anything, and I get  
> the darn raise string, but not a trace back to the line where it  
> occurred. In fact it appears my use of rescue is hiding the information  
> I might get otherwise. Can someone give me some suggestions. My  
> apologies if this should be obvious.

Is Exception#backtrace what you’re looking for?

From the RDoc:

def a  
raise “boom”  
end

def b  
a()  
end

begin  
b()  
rescue =\> detail  
print detail.backtrace.join("\n")  
end

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 30, 2009, 4:13am UTC](https://www.ruby-forum.com/t/caller-usage-and-getting-a-full-trace-after-a-rescue-on-general-exception/171282/3 "2009-06-30T04:13:02Z")

</div>

Aaron P. wrote:

> On Tue, Jun 30, 2009 at 07:38:22AM +0900, Xeno C. wrote:
> 
> > Say, I’m having a difficult problem getting a complete trace/stack dump.  
> > I’ve got a place where I do a rescue Exception for anything, and I get  
> > the darn raise string, but not a trace back to the line where it  
> > occurred. In fact it appears my use of rescue is hiding the information  
> > I might get otherwise. Can someone give me some suggestions. My  
> > apologies if this should be obvious.
> 
> Is Exception#backtrace what you’re looking for?

Yes, thank you very much. That helped. I would have responded sooner,  
but this  
week’s death march and all you know.

Thanks.
