-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
90 lines (67 loc) · 2.75 KB
/
errors.go
File metadata and controls
90 lines (67 loc) · 2.75 KB
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
82
83
84
85
86
87
88
89
90
package farp
import "errors"
// Common errors.
var (
// ErrManifestNotFound is returned when a schema manifest is not found.
ErrManifestNotFound = errors.New("schema manifest not found")
// ErrSchemaNotFound is returned when a schema is not found.
ErrSchemaNotFound = errors.New("schema not found")
// ErrInvalidManifest is returned when a manifest has invalid format.
ErrInvalidManifest = errors.New("invalid manifest format")
// ErrInvalidSchema is returned when a schema has invalid format.
ErrInvalidSchema = errors.New("invalid schema format")
// ErrSchemaToLarge is returned when a schema exceeds size limits.
ErrSchemaToLarge = errors.New("schema exceeds size limit")
// ErrChecksumMismatch is returned when a schema checksum doesn't match.
ErrChecksumMismatch = errors.New("schema checksum mismatch")
// ErrUnsupportedType is returned when a schema type is not supported.
ErrUnsupportedType = errors.New("unsupported schema type")
// ErrBackendUnavailable is returned when the backend is unavailable.
ErrBackendUnavailable = errors.New("backend unavailable")
// ErrIncompatibleVersion is returned when protocol versions are incompatible.
ErrIncompatibleVersion = errors.New("incompatible protocol version")
// ErrInvalidLocation is returned when a schema location is invalid.
ErrInvalidLocation = errors.New("invalid schema location")
// ErrProviderNotFound is returned when a schema provider is not found.
ErrProviderNotFound = errors.New("schema provider not found")
// ErrRegistryNotConfigured is returned when no registry is configured.
ErrRegistryNotConfigured = errors.New("schema registry not configured")
// ErrSchemaFetchFailed is returned when schema fetch fails.
ErrSchemaFetchFailed = errors.New("failed to fetch schema")
// ErrValidationFailed is returned when schema validation fails.
ErrValidationFailed = errors.New("schema validation failed")
)
// ManifestError represents a manifest-specific error.
type ManifestError struct {
ServiceName string
InstanceID string
Err error
}
func (e *ManifestError) Error() string {
return "manifest error for service=" + e.ServiceName +
" instance=" + e.InstanceID + ": " + e.Err.Error()
}
func (e *ManifestError) Unwrap() error {
return e.Err
}
// SchemaError represents a schema-specific error.
type SchemaError struct {
Type SchemaType
Path string
Err error
}
func (e *SchemaError) Error() string {
return "schema error type=" + string(e.Type) +
" path=" + e.Path + ": " + e.Err.Error()
}
func (e *SchemaError) Unwrap() error {
return e.Err
}
// ValidationError represents a validation error.
type ValidationError struct {
Field string
Message string
}
func (e *ValidationError) Error() string {
return "validation error: field=" + e.Field + " message=" + e.Message
}