forked from hugohn/mpc-cmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
29 lines (24 loc) · 659 Bytes
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package protocol
import (
"fmt"
"github.com/taurusgroup/multi-party-sig/pkg/party"
)
// Error is a custom error for protocols which contains information about the responsible round in which it occurred,
// and the party responsible.
type Error struct {
// Culprit is empty if the identity of the misbehaving party cannot be known.
Culprits []party.ID
// Err is the underlying error.
Err error
}
// Error implement error.
func (e Error) Error() string {
if e.Culprits == nil {
return e.Err.Error()
}
return fmt.Sprintf("culprits: %v: %s", e.Culprits, e.Err)
}
// Unwrap implement errors.Wrapper.
func (e Error) Unwrap() error {
return e.Err
}