forked from keybase/kbfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
38 lines (30 loc) · 928 Bytes
/
errors.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
30
31
32
33
34
35
36
37
38
// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package kbfshash
import "fmt"
// InvalidHashError is returned whenever an invalid hash is
// detected.
type InvalidHashError struct {
H Hash
}
func (e InvalidHashError) Error() string {
return fmt.Sprintf("Invalid hash %s", e.H)
}
// UnknownHashTypeError is returned whenever a hash with an unknown
// hash type is attempted to be used for verification.
type UnknownHashTypeError struct {
T HashType
}
func (e UnknownHashTypeError) Error() string {
return fmt.Sprintf("Unknown hash type %s", e.T)
}
// HashMismatchError is returned whenever a hash mismatch is detected.
type HashMismatchError struct {
ExpectedH Hash
ActualH Hash
}
func (e HashMismatchError) Error() string {
return fmt.Sprintf("Hash mismatch: expected %s, got %s",
e.ExpectedH, e.ActualH)
}