15 Commits

Author SHA1 Message Date
Dave Cheney
d56363987d Remove Frame methods
errors.Frame is convertable from/to a runtime.Frame and know how to
print itself.

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:59:15 +11:00
Dave Cheney
e19cb699ad
Remove last reference to runtime.FuncForPC (#184)
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:41:10 +11:00
Dave Cheney
4f47277723
Switch to runtime.CallersFrames (#183)
Fixes #160
Fixes #107

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:23:03 +11:00
Mark Ayers
30136e27e2 Remove deadcode (#146) 2018-01-27 12:58:12 +11:00
Tibor Benke
e4f5060297 Fix doc comment for exported Format func (#137)
Fixes #136

Signed-off-by: Tibor Benke <ihrwein@gmail.com>
2017-12-10 10:30:25 +11:00
Matthew Hardwick
c605e284fe Add doc comment for exported Format func (#115) 2017-05-05 14:36:39 +10:00
Dave Cheney
785921b1c1 Destructure New/Errorf
Destructure New/Errorf into two components, a call to the stdlib
errors.New or fmt.Errorf to generate a _fundamental_ error, and then a
call to withStack to attach a stack trace to the message.
2016-08-08 14:31:22 +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
2c9da72fa5 fix typos 2016-06-07 17:26:48 +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