-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
errors.go
163 lines (131 loc) · 4.47 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
// Package rtcerr implements the error wrappers defined throughout the
// WebRTC 1.0 specifications.
package rtcerr
import (
"fmt"
)
// UnknownError indicates the operation failed for an unknown transient reason.
type UnknownError struct {
Err error
}
func (e *UnknownError) Error() string {
return fmt.Sprintf("UnknownError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *UnknownError) Unwrap() error {
return e.Err
}
// InvalidStateError indicates the object is in an invalid state.
type InvalidStateError struct {
Err error
}
func (e *InvalidStateError) Error() string {
return fmt.Sprintf("InvalidStateError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *InvalidStateError) Unwrap() error {
return e.Err
}
// InvalidAccessError indicates the object does not support the operation or
// argument.
type InvalidAccessError struct {
Err error
}
func (e *InvalidAccessError) Error() string {
return fmt.Sprintf("InvalidAccessError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *InvalidAccessError) Unwrap() error {
return e.Err
}
// NotSupportedError indicates the operation is not supported.
type NotSupportedError struct {
Err error
}
func (e *NotSupportedError) Error() string {
return fmt.Sprintf("NotSupportedError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *NotSupportedError) Unwrap() error {
return e.Err
}
// InvalidModificationError indicates the object cannot be modified in this way.
type InvalidModificationError struct {
Err error
}
func (e *InvalidModificationError) Error() string {
return fmt.Sprintf("InvalidModificationError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *InvalidModificationError) Unwrap() error {
return e.Err
}
// SyntaxError indicates the string did not match the expected pattern.
type SyntaxError struct {
Err error
}
func (e *SyntaxError) Error() string {
return fmt.Sprintf("SyntaxError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *SyntaxError) Unwrap() error {
return e.Err
}
// TypeError indicates an error when a value is not of the expected type.
type TypeError struct {
Err error
}
func (e *TypeError) Error() string {
return fmt.Sprintf("TypeError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *TypeError) Unwrap() error {
return e.Err
}
// OperationError indicates the operation failed for an operation-specific
// reason.
type OperationError struct {
Err error
}
func (e *OperationError) Error() string {
return fmt.Sprintf("OperationError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *OperationError) Unwrap() error {
return e.Err
}
// NotReadableError indicates the input/output read operation failed.
type NotReadableError struct {
Err error
}
func (e *NotReadableError) Error() string {
return fmt.Sprintf("NotReadableError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *NotReadableError) Unwrap() error {
return e.Err
}
// RangeError indicates an error when a value is not in the set or range
// of allowed values.
type RangeError struct {
Err error
}
func (e *RangeError) Error() string {
return fmt.Sprintf("RangeError: %v", e.Err)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
func (e *RangeError) Unwrap() error {
return e.Err
}