Skip to content

Commit

Permalink
Add werror.GenerateErrorString for generating the stacktrace param st…
Browse files Browse the repository at this point in the history
…ring (#51)
  • Loading branch information
k-simons authored and bmoylan committed Jun 4, 2019
1 parent 87637ec commit 0d8e0cf
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
name = "github.com/palantir/pkg"
version = ">=0.7.0"

[[constraint]]
name = "github.com/palantir/witchcraft-go-error"
version = ">=1.1.0"

[[constraint]]
name = "github.com/rs/zerolog"
version = "1.10.3"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions vendor/github.com/palantir/witchcraft-go-error/werror.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions wlog/svclog/svc1log/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package svc1log

import (
"fmt"
"path"
"runtime"
"strconv"
Expand Down Expand Up @@ -177,17 +176,7 @@ func Stacktrace(err error) Param {
if err == nil {
return
}

// set the value of the error
errStr := err.Error()
if fancy, ok := err.(fmt.Formatter); ok {
verbose := fmt.Sprintf("%+v", fancy)
if verbose != errStr {
// this is a rich error type, like those produced by github.com/pkg/errors
errStr = verbose
}
}
entry.StringValue(StacktraceKey, errStr)
entry.StringValue(StacktraceKey, werror.GenerateErrorString(err, false))

// add all safe and unsafe parameters stored in error
safeParams, unsafeParams := werror.ParamsFromError(err)
Expand Down

0 comments on commit 0d8e0cf

Please sign in to comment.