-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
60 lines (49 loc) · 1.55 KB
/
errors.go
File metadata and controls
60 lines (49 loc) · 1.55 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
// SPDX-License-Identifier: Apache-2.0
// Copyright Contributors to the OpenTimelineIO project
package gotio
import (
"errors"
"fmt"
)
// Error types for opentimelineio.
var (
ErrNotFound = errors.New("not found")
ErrMissingReference = errors.New("missing reference")
ErrMediaReferenceNotFound = errors.New("media reference not found")
ErrCannotComputeAvailableRange = errors.New("cannot compute available range")
ErrInvalidTimecode = errors.New("invalid timecode")
ErrChildAlreadyHasParent = errors.New("child already has a parent")
ErrNotAChild = errors.New("item is not a child of a composition")
ErrNoCommonAncestor = errors.New("items do not share a common ancestor")
)
// IndexError indicates an index out of bounds.
type IndexError struct {
Index int
Size int
}
func (e *IndexError) Error() string {
return fmt.Sprintf("index %d out of bounds for size %d", e.Index, e.Size)
}
// TypeMismatchError indicates a type mismatch.
type TypeMismatchError struct {
Expected string
Got string
}
func (e *TypeMismatchError) Error() string {
return fmt.Sprintf("expected %s, got %s", e.Expected, e.Got)
}
// SchemaError indicates a schema error.
type SchemaError struct {
Schema string
Message string
}
func (e *SchemaError) Error() string {
return fmt.Sprintf("schema %s: %s", e.Schema, e.Message)
}
// JSONError indicates a JSON parsing error.
type JSONError struct {
Message string
}
func (e *JSONError) Error() string {
return fmt.Sprintf("JSON error: %s", e.Message)
}