The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Refactor #13341

Add support for nested exceptions in Puppet::Error

Added by Chris Price about 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:03/22/2012
Priority:HighDue date:
Assignee:Patrick Carlisle% Done:

0%

Category:-
Target version:-
Affected Puppet version: Branch:https://github.com/pcarlisle/puppet/tree/ticket/master/13341-nested-exceptions
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

There are a decent number of places in the code where we catch an exception and then raise a Puppet::Error in response. This can be a useful pattern when we have any extra information to add to the exception, but it comes at a painfully high price if we aren’t careful not to lose the backtrace information from the original exception.

I would like to add an optional extra argument to the constructor for Puppet::Error that would allow you to pass in a nested exception, and then tweak the Logging#log_exception method to print the full series of backtraces when it is called with a Puppet::Error that takes advantage of this nesting.

Daniel, can you let me know if you have any concerns about this proposal? If not I will probably tackle it relatively soon because I think it could be extremely helpful for debugging and troubleshooting.


Related issues

Related to Puppet - Bug #16027: Stack traces are printed without method names Closed 08/18/2012
Related to Puppet - Bug #20383: Bring back helpful error messages like prior to Puppet 3 Closed
Related to Puppet - Bug #20920: Include file and line number on invalid resource relation... Closed

History

#1 Updated by Daniel Pittman about 2 years ago

This sounds great to me. I can’t see any reason why this wouldn’t be desirable, provided we treat an empty nested exception slot sanely – since third party code can and should raise these. We should consider inserting the minimal support – the accessor – into 2.7.x as well as Telly, so that code that sets the nested exception works across both platforms. The actual printing changes might be more appropriate only in Telly.

#2 Updated by Chris Price about 2 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Daniel Pittman to Chris Price

#3 Updated by Chris Price almost 2 years ago

  • Assignee changed from Chris Price to Patrick Carlisle

#4 Updated by Patrick Carlisle almost 2 years ago

  • Branch set to https://github.com/pcarlisle/puppet/tree/ticket/master/13341-nested-exceptions

Working on this here https://github.com/pcarlisle/puppet/tree/ticket/master/13341-nested-exceptions not quite ready yet

#5 Updated by Patrick Carlisle almost 2 years ago

Should be ready to merge now

#6 Updated by Andrew Parker over 1 year ago

  • Target version deleted (3.x)

This was released in 3.0.0. And was done in commit ac83f85

#7 Updated by Andrew Parker over 1 year ago

  • Status changed from Accepted to Closed

Also available in: Atom PDF