HomePhorge

(PUP-4054) Remove unhelpful unwrapping of errors in create_resources
f3a808e9025eUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-4054) Remove unhelpful unwrapping of errors in create_resources

Before this fix, if Puppet::ParseError was raised with a causing
(original) error associated with it, the original error was unwrapped
and passed on. This led to valuable information being lost as the
original error would typically be a lower level ArgumentError that has
no information about file and line.
This in turn means that the error is reported against the call to
create_resources as opposed to the actual location in puppet source that
invoked the logic that in turn triggered the ArgumentError.

This can be observed by having create_resource create a defined resource
that attempts to add two strings.

The fix is simply to remove the unwrapping and not catching the error at
all. With this implementation the error is as detailed as it can get,
albeit slightly oddly formatted in some cases since the original error
is also presented with a 'wrapped exception' label.

Note that 3x is notoriously bad in associating the error with the
correct line number - it reports the error on the line after the actual
position in many cases (or at end of file, end of block). This fix does
not attempt to correct that (instead, use the future parser where
this works).

Details

Provenance
Henrik Lindberg <henrik.lindberg@cloudsmith.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUcc9ec6bd1cb4: (PUP-4047) Rephrase error message for "non productive errors"
Branches
Unknown
Tags
Unknown

Event Timeline

Henrik Lindberg <henrik.lindberg@cloudsmith.com> committed rPUf3a808e9025e: (PUP-4054) Remove unhelpful unwrapping of errors in create_resources (authored by Henrik Lindberg <henrik.lindberg@cloudsmith.com>).Mar 3 2015, 12:12 AM