tmerror now dumps stack trace on %+v as well
This commit is contained in:
parent
4eef581396
commit
aa0c246f64
|
@ -5,6 +5,8 @@ package errors
|
|||
**/
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
|
@ -37,6 +39,17 @@ func (t tmerror) Message() string {
|
|||
return t.msg
|
||||
}
|
||||
|
||||
// Format handles "%+v" to expose the full stack trace
|
||||
// concept from pkg/errors
|
||||
func (t tmerror) Format(s fmt.State, verb rune) {
|
||||
// special case also show all info
|
||||
if verb == 'v' && s.Flag('+') {
|
||||
fmt.Fprintf(s, "%+v\n", t.stackTracer)
|
||||
}
|
||||
// always print the normal error
|
||||
fmt.Fprintf(s, "(%d) %s\n", t.code, t.msg)
|
||||
}
|
||||
|
||||
// Result converts any error into a abci.Result, preserving as much info
|
||||
// as possible if it was already a TMError
|
||||
func Result(err error) abci.Result {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package stack
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
|
||||
"github.com/tendermint/basecoin"
|
||||
|
@ -53,9 +51,7 @@ func (h Signatures) DeliverTx(ctx basecoin.Context, store types.KVStore, tx base
|
|||
|
||||
func addSigners(ctx basecoin.Context, sigs []crypto.PubKey) basecoin.Context {
|
||||
perms := make([]basecoin.Actor, len(sigs))
|
||||
fmt.Printf("Add %d signers\n", len(sigs))
|
||||
for i, s := range sigs {
|
||||
fmt.Printf("Add %X\n", s.Address())
|
||||
perms[i] = SigPerm(s.Address())
|
||||
}
|
||||
// add the signers to the context and continue
|
||||
|
@ -63,10 +59,8 @@ func addSigners(ctx basecoin.Context, sigs []crypto.PubKey) basecoin.Context {
|
|||
}
|
||||
|
||||
func getSigners(tx basecoin.Tx) ([]crypto.PubKey, basecoin.Tx, error) {
|
||||
fmt.Println("getSigners")
|
||||
stx, ok := tx.Unwrap().(Signed)
|
||||
if !ok {
|
||||
fmt.Printf("Not okay: %#v\n", tx)
|
||||
return nil, basecoin.Tx{}, errors.Unauthorized()
|
||||
}
|
||||
sig, err := stx.Signers()
|
||||
|
|
Loading…
Reference in New Issue