-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
errors.go
81 lines (64 loc) · 2.14 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2019 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 data
import (
"fmt"
"github.com/keybase/client/go/kbfs/kbfsblock"
)
// NameExistsError indicates that the user tried to create an entry
// for a name that already existed in a subdirectory.
type NameExistsError struct {
Name string
}
// Error implements the error interface for NameExistsError
func (e NameExistsError) Error() string {
return fmt.Sprintf("%s already exists", e.Name)
}
// BadSplitError indicates that the BlockSplitter has an error.
type BadSplitError struct {
}
// Error implements the error interface for BadSplitError
func (e BadSplitError) Error() string {
return "Unexpected bad block split"
}
// BadDataError indicates that KBFS is storing corrupt data for a block.
type BadDataError struct {
ID kbfsblock.ID
}
// Error implements the error interface for BadDataError
func (e BadDataError) Error() string {
return fmt.Sprintf("Bad data for block %v", e.ID)
}
// NoSuchBlockError indicates that a block for the associated ID doesn't exist.
type NoSuchBlockError struct {
ID kbfsblock.ID
}
// Error implements the error interface for NoSuchBlockError
func (e NoSuchBlockError) Error() string {
return fmt.Sprintf("Couldn't get block %v", e.ID)
}
// NotDirectFileBlockError indicates that a direct file block was
// expected, but something else (e.g., an indirect file block) was
// given instead.
type NotDirectFileBlockError struct {
}
func (e NotDirectFileBlockError) Error() string {
return "Unexpected block type; expected a direct file block"
}
// CachePutCacheFullError indicates that a cache put failed because
// the cache was full.
type CachePutCacheFullError struct {
BlockID kbfsblock.ID
}
func (e CachePutCacheFullError) Error() string {
return fmt.Sprintf("failed to put block due to full cache. Block: %s",
e.BlockID)
}
// ShutdownHappenedError indicates that shutdown has happened.
type ShutdownHappenedError struct {
}
// Error implements the error interface for ShutdownHappenedError.
func (e ShutdownHappenedError) Error() string {
return "Shutdown happened"
}