142 Commits

Author SHA1 Message Date
Dave Cheney
ee4766c291 Fix error during merge
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 21:50:40 +11:00
Dave Cheney
25793cafd5 Merge branch 'master' of ssh://github.com/cstockton/errors into cstockton-master 2019-01-05 21:40:34 +11:00
Dave Cheney
584cbace28
Remove checks for old style anon funcs (#186)
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 21:07:35 +11:00
Dave Cheney
42ce1b6a12
Remove Frame methods (#185)
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 20:05:53 +11:00
Dave Cheney
308074fef0 Merge branch 'bep-patch-1' 2019-01-05 19:54:34 +11:00
Dave Cheney
937e8c5528 gofmt -w
Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 19:54:25 +11:00
Dave Cheney
c1bc528f85
Merge branch 'master' into patch-1 2019-01-05 19:50:32 +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
Dave Cheney
537896ad6e
travis: remove Go 1.8 and earlier (#182)
Remove support for Go 1.8 and earlier as they are

a. no longer supported upstream
b. lack support for runtime.CallerFrames

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 15:00:06 +11:00
Dave Cheney
31aac83bad
travis: use Makefile (#181)
Add a bunch of useful makefile targets

Signed-off-by: Dave Cheney <dave@cheney.net>
2019-01-05 14:54:17 +11:00
Dave Cheney
5ac96aea29
Update README.md 2019-01-05 13:32:11 +11:00
Tariq Ibrahim
ba968bfe8b gofmt -w errors.go (#179) v0.8.1 2019-01-03 17:52:24 +11:00
Komu Wairagu
059132a15d Update .travis.yml (#168) 2018-10-24 10:59:46 +11:00
Harald Nordgren
d58f942510 Bump Travis versions (#172) 2018-10-21 09:29:33 +11:00
Bjørn Erik Pedersen
6ed0a2e59e
Fix StackTrace print example 2018-10-14 16:58:47 +02:00
Steven E. Harris
2233dee583 Copyedit the package documentation (#135)
Remove spurious words, add missing words, and smooth out a few
sentences.
2018-10-08 15:53:15 +11:00
Dariusz Jedrzejczyk
e981d1a2c5 Add WithMessagef function (#118)
WithMessagef utility function to accompany WithMessage, similar to
exiting Wrapf function accompanying Wrap.
2018-10-08 15:50:16 +11:00
Eldar Rakhimberdin
c059e472ca fixed spelling (#156) 2018-09-11 16:21:13 +10:00
Dave Cheney
816c908556
travis.yml: add Go 1.10 (#154) 2018-03-12 08:45:15 +11:00
Chris Stockton
e1ac100e46 reduce allocations when printing stack traces (#149) 2018-02-17 10:57:01 -07:00
Mark Ayers
30136e27e2 Remove deadcode (#146) 2018-01-27 12:58:12 +11:00
Tom Sweeney
e881fd58d7 Fix minor typo in README.md (#142)
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-12-16 18:03:16 +11:00
Nick Snyder
8842a6e0cc Add badge for number of dependent libraries (#109) 2017-12-10 13:24:16 +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
haya14busa
f15c970de5 Remove an unused argument of utility test func (#139)
Found this by https://github.com/mvdan/unparam
2017-10-19 06:55:49 +11:00
Davor Kapsa
2b3a18b5f0 travis: add 1.9.x to go versions (#133) 2017-09-10 23:46:14 +10:00
Matthew Hardwick
c605e284fe Add doc comment for exported Format func (#115) 2017-05-05 14:36:39 +10:00
Alexey Palazhchenko
ff09b135c2 Bump Go versions, use latest patch releases (#110) 2017-03-17 07:15:38 +11:00
Bradley Falzon
bfd5150e4e Move benchmark assigned err to global exported variable (#106)
toperr is not used, but the go compiler itself doesn't detect this
because it's within an anonymous function. However, go/types does
detect this as being unused, which causes any static analysis tools
which uses go/types' type checker to fail with the message "toperr
assigned and not used".

The final result of the benchmarked function is instead assigned to
an exported global variable to ensure the compiler cannot now, nor
in the future optimise away the function calls due to no observable
side effects.

It was chosen to assign the final result, after the benchmark loop,
to the global variable, as this best follows the example set in the
CL https://go-review.googlesource.com/#/c/37195/. As opposed to
having each call to f assign to the global. This also appears to
better align with the original author's intention of toperr.

This change had no observable impact on the benchmark.

Related https://github.com/golang/go/issues/3059.
Related https://github.com/golang/go/issues/8560.

Thanks dominikh for additional clarifications.
2017-02-28 09:00:37 +11:00
Alexey Palazhchenko
248dadf4e9 Bump Go versions (#91) 2016-10-29 20:36:37 +11:00
Nick Miyake
839d9e913e Fix minor newline consistency issues in test files (#87) 2016-10-02 16:25:12 +11:00
Dave Cheney
645ef00459 doc tweaks v0.8.0 2016-09-29 11:48:01 +10:00
Dave Cheney
7433cb070c fix line numbers in fmt tests 2016-09-29 11:32:15 +10:00
Nick Miyake
3a4fafe48b Fix comment on WithMessage function (#86) 2016-09-29 11:32:15 +10:00
fabstu
1398fbcad1 tests: fixed tests on 1.4. 2016-09-29 11:32:15 +10:00
fabstu
162fea7c06 tests: added recursively trying out combinations of calls for %+v. 2016-09-29 11:32:15 +10:00
fabstu
542b81d67c minor: refactored small loop 2016-09-29 11:32:15 +10:00
fabstu
011399d349 Add WithStack and WithMessage tests
Adds testFormatCompleteCompare as additional testing func.

The new function takes a string slice as "want", wherein
stacktraces and non-stacktrace messages are discerned by
strings.ContainsAny(want[i], "\n").

For example usage, see TestFormatWithStack & TestFormatWithMessage.
2016-09-29 11:32:15 +10:00
Dave Cheney
4f8d1cf2a2 Revert "Remove WithStack and WithMessage public functions"
This reverts commit 1b876e063eebebbcbab83aafa8bc631edef98fff.
2016-09-29 11:32:15 +10:00
Thomas de Zeeuw
a887431f7f Add Go 1.7.1 to Travis (#85) 2016-09-16 21:02:12 +10:00
Nick Craig-Wood
17b591df37 Fix the %q format for errors so it puts "" around the output (#83) v0.7.1 2016-08-22 10:00:10 +01:00
Dave Cheney
a22138067a remove incorrect comment 2016-08-08 15:55:40 +10:00
Dave Cheney
9cadab9279 Merge pull request #81 from pkg/withMessage-withStack
Refactor withMessage/withStack
2016-08-08 14:49:31 +10:00
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
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
Paul Robins
2a9be18ecd Modify TestTrimGOPATH to ensure tests pass while vendored (#78) 2016-08-01 20:26:19 +10:00
Daniel Theophanes
1d2e60385a errors: add a benchmark comparing stack trace performance (#74)
Fixes #72
2016-07-24 12:43:27 +10:00
Alexey Palazhchenko
cc5fbb72d9 Documentation improvements (#69)
* Add install instructions.

* Document that causer and stackTracer are stable.
2016-07-19 19:13:40 +10:00