11 Commits

Author SHA1 Message Date
Dave Cheney
1b876e063e Remove WithStack and WithMessage public functions
The refactoring to use withStack and withMessage types is useful enough
to land indepdently of exposing these helpers publically.
2016-08-08 14:39:38 +10:00
Dave Cheney
777ed74de5 Destructure Wrap{,f} into WithStack(WithMessage(err, msg))
Introduces WithMessage as well as errors.fundamental, errors.withMessage
and errors.withStack internal types.

Adjust tests for the new wrapped format when combining fundamental and
wrapped errors.
2016-08-08 14:31:22 +10:00
Paul Robins
2a9be18ecd Modify TestTrimGOPATH to ensure tests pass while vendored (#78) 2016-08-01 20:26:19 +10:00
Jon Gillham
d62207b3dc Capitalise first letter of trace. (#60) 2016-06-27 12:13:31 +10:00
Dave Cheney
73d71e4a6a Rename Stacktrace to StackTrace (#51)
Fixes #50
2016-06-13 11:11:14 +10:00
Dave Cheney
7896481a53 Extended stacktrace output (#49)
* Extended stacktrace output

* Make format tests less sensitive to sourcecode prefix

* use testFormatRegexp for all Sprintf tests

* replace output test with sample output

* work around the different fn.Name format in go 1.4

* fix windows tests when there is a drive letter in the source path
2016-06-11 23:04:57 +10:00
Dave Cheney
a5b220e0c6 Introduce errors.Stacktrace (#48)
* Introduce errors.Stacktrace

Introduce a new type to replace the unnamed return value from
`Stacktrace()`. `Stacktrace` implements `fmt.Formatter` and currently
replicates the default behaviour of printing a `[]Frame`.

In a future PR the values of `%+v` and `%#v` will be extended to
implement a more readable stacktrace.
2016-06-10 14:10:18 +10:00
Dave Cheney
5776abf3b9 Remove deprecated Stack() []uintptr interface (#45)
* Remove deprecated Stack() []uintptr interface

* move TestStack to TestStacktrace
2016-06-10 00:48:07 +10:00
Dave Cheney
19140ea8c4 Remove deprecated Location interface 2016-06-08 19:34:10 +10:00
Dave Cheney
e23d6edfd2 extract funcname helper, and add test 2016-06-08 19:21:37 +10:00
Dave Cheney
3cdd33210d Introduce Stacktrace and Frame (#37)
* Introduce Stacktrace and Frame

This PR is a continuation of a series aimed at exposing the stack trace
information embedded in each error value. The secondary effect is to
deprecated the `Fprintf` helper.

Taking cues from from @chrishines' `stack` package this PR introduces a
new interface `Stacktrace() []Frame` and a `Frame` type, similar in
function to the `runtime.Frame` type (although lacking its iterator
type). Each `Frame` implemnts `fmt.Formatter` allowing it to print
itself.

The older `Location` interface is still supported but also deprecated.
2016-06-07 14:23:05 +10:00