67 Commits

Author SHA1 Message Date
Dave Cheney
e23d6edfd2 extract funcname helper, and add test 2016-06-08 19:21:37 +10:00
Dave Cheney
f22595b332 fix Stacktrace example 2016-06-07 18:47:44 +10:00
Dave Cheney
2c9da72fa5 fix typos v0.6.0 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
Dave Cheney
f45f2b7903 add appveyor.yml (#36) 2016-06-07 07:41:47 +10:00
Dave Cheney
b700c3e918 fix typo 2016-06-06 20:27:34 +10:00
Dave Cheney
431554f80b Remove errors.wrap helper
`errors.wrap` existed to avoid the conflict between the type,
`errors.cause` and the formal parameter `cause`. The parameter was
renamed to err in #32 so there is no need for the helper.
2016-05-26 15:24:04 +10:00
Mat Ryer
936b5d744d renamed cause argument to err - fixes #32 (#33) 2016-05-25 09:59:37 +10:00
Dave Cheney
e8c21980b6 Make errors.stack comparable (#30)
Fixed #29

errors.New, etc values are not expected to be compared by value but
the change in errors#27 made them incomparable. Assert that various
kinds of errors have a functional equality operator, even if the
result of that equality is always false.
v0.5.1
2016-05-24 12:36:43 +10:00
Dave Cheney
abe54b4bad Added more Stack tests v0.5.0 2016-05-23 19:19:03 +10:00
Dave Cheney
cc157cd49f Store the stack of the caller to New, Errorf, Wrap and Wrapf (#27)
Store up to 32 stack frames for the caller to New, Errorf, Wrap, and
Wrapf.
2016-05-23 18:47:43 +10:00
Dave Cheney
eeffa134b5 update go 1.6 version 2016-05-23 17:46:48 +10:00
Dave Cheney
567ccaadc6 Split stack.Location into a private helper 2016-05-23 17:36:45 +10:00
Dave Cheney
80cce0ee9b Rename errors.location to errors.stack (#26) 2016-05-23 17:32:36 +10:00
Dave Cheney
daa1017c6f Refactor errors.location to be a stack of callers (#25)
Refactory errors.location to be a stack of callers rather than the
topmost caller. This is in perparation for storing the entire error
stack inside topmost error.
2016-05-23 17:10:14 +10:00
Dave Cheney
d814416a46 update package description (#24) v0.4.0 2016-05-11 07:41:07 +10:00
Dave Cheney
01fff4b066 Remove errors.Print (#23)
errors.Print had a number of problems. Firstly, it was hard coded to
print to os.Stderr, which made it difficult to test, and hard to write
an example test for. Secondly, comments made in issue #20 make it clear
that helpers need to have a high bar for inclusion in this package, and
something that wrapped errors.Fprint in a way that was hard to test
fails that bar.

So, Remove errors.Print, which frees the identifier for being reused
later, and reduces the size of the package.
2016-05-10 11:02:00 +10:00
Mustafa Akın
502e17a0cb Syntax coloring for Readme
I think it helps readability.
2016-05-09 18:42:59 +10:00
Jud White
0d62637d04 errors.go: "nor" -> "not" (typo fix) (#17) 2016-05-04 06:53:04 +08:00
Jud White
42fa80f2ac README.md: "nor" -> "not", backtick causer (#16)
Note there's inconsistency on the casing of `causer` in the README and function documentation.
v0.3.0
2016-05-03 03:39:29 +08:00
Santiago Corredoira Lascaray
7a0abd8f63 Add Errorf (#14) 2016-04-30 08:38:57 +10:00
Dave Cheney
cd6e0b425d address spelling mistakes. Thanks @seh 2016-04-27 10:39:47 +10:00
Dave Cheney
6526c1c7e1 update link to more detail 2016-04-27 07:38:35 +10:00
Dave Cheney
7efa461bd3 Fix spelling mistake in comment 2016-04-26 12:27:40 +10:00
Dave Cheney
3612ec480e Remove the errors.e type (#11)
* rename loc type to location

* move locationer interface inside Fprint, rename to location

* refactor Wrap/Wrapf into helper method

* remove errors.e type, compose an anon struct in wrap and add a Message() interface method to extract the cause message
2016-04-26 12:25:34 +10:00
Dave Cheney
f85d45fecf Merge pull request #7 from umairidris/wrapf
Add Wrapf
v0.2.0
2016-04-25 13:42:03 +09:00
Umair Idris
9a179122f1 Add Wrapf 2016-04-25 00:31:25 -04:00
Dave Cheney
c86dfceef5 Merge pull request #9 from ChrisHines/location-path-fix
Infer compile time GOPATH from fn.Name().
2016-04-25 10:41:41 +09:00
Chris Hines
046fc1474d Updates from code review. 2016-04-24 21:36:07 -04:00
Chris Hines
665006faab Infer compile time GOPATH from fn.Name(). 2016-04-24 20:49:56 -04:00
Dave Cheney
ab94cc2ab2 fix loc.Location, re-enable tip 2016-04-25 07:42:30 +09:00
Dave Cheney
346b85b84a updated README 2016-04-25 07:39:22 +09:00
Dave Cheney
1ada8c027c Merge pull request #3 from msoap/patch-1
Updated badge for godoc
2016-04-25 07:31:36 +09:00
Dave Cheney
326f4a44f3 Merge pull request #5 from umairidris/master
gofmt and typo fix
2016-04-25 07:30:45 +09:00
Umair Idris
c94cbcebe9 gofmt and typo fix 2016-04-24 15:34:22 -04:00
Sergey Mudrik
44b1da7f05 Updated badge for godoc
Changed to SVG format, this useful for HiDPI displays.
2016-04-24 20:51:26 +03:00
Dave Cheney
d363daa49f add go report card v0.1.0 2016-04-24 21:18:34 +09:00
Dave Cheney
1c843d4ac5 spelling 2016-04-24 20:57:12 +09:00
Dave Cheney
bca5e1997f readme 2016-04-24 20:55:50 +09:00
Dave Cheney
326e08fb88 godoc 2016-04-24 20:53:36 +09:00
Dave Cheney
d20a8b856c update readme 2016-04-24 20:35:34 +09:00
Dave Cheney
4a91b9e367 Merge pull request #2 from enisoc/format-string
Don't pass arbitrary strings as Errorf() format strings.
2016-04-24 16:25:53 +09:00
Anthony Yeh
44b2f1e7ac Don't pass arbitrary strings as Errorf() format strings.
Sometimes they happen to contain format specifiers, which results in
things like "%!v(MISSING)".
2016-04-24 00:08:22 -07:00
Dave Cheney
92a59f4973 Update Readme 2016-04-23 15:18:03 +09:00
Dave Cheney
bb658ea0e4 Update readne 2016-04-23 15:17:21 +09:00
Dave Cheney
9eacf05e26 update package doc 2016-04-23 14:27:48 +09:00
Dave Cheney
a15b27b2bf fix second errors.New example 2016-04-22 20:15:46 +09:00
Dave Cheney
109ee590a8 simplify pc 2016-04-22 19:32:12 +09:00
Dave Cheney
258d1265c4 skip tests on tip 2016-04-22 19:19:39 +09:00
Dave Cheney
8f9a2e151e update travis.yml 2016-04-22 19:16:52 +09:00