Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

[errors] Add functions to Wrap errors and preserve type #94

Merged
merged 2 commits into from
Sep 7, 2017

Conversation

jeromefroe
Copy link
Contributor

This PR adds two functions, Wrap and Wrapf, that allow one to wrap an error with additional context while still preserving the underlying type of the error. These functions address the problem that one cannot use fmt.Errorf to wrap errors because that loses the type information of the error which is being wrapped. One can accomplish the same thing currently with NewRenamedError and Wrap and Wrapf aim to make such tasks easier to perform.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.1%) to 79.122% when pulling 98ceb19 on jeromefroe/errors/add-functions-to-wrap-errors into 3f78c00 on master.

Copy link
Contributor

@prateek prateek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeromefroe jeromefroe merged commit fd0406c into master Sep 7, 2017
@jeromefroe jeromefroe deleted the jeromefroe/errors/add-functions-to-wrap-errors branch September 7, 2017 02:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants