-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
45 lines (38 loc) · 899 Bytes
/
errors.go
File metadata and controls
45 lines (38 loc) · 899 Bytes
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
//go:build darwin || freebsd || linux || netbsd || windows
package mago
import "fmt"
type OpError struct {
Op string
Code Result
Description string
}
type VersionMismatchError struct {
Expected Version
Actual Version
ExpectedString string
ActualString string
}
func (e *OpError) Error() string {
switch {
case e == nil:
return "<nil>"
case e.Description != "":
return fmt.Sprintf("%s failed: %s (%d)", e.Op, e.Description, e.Code)
case e.Op != "":
return fmt.Sprintf("%s failed with result %d", e.Op, e.Code)
default:
return fmt.Sprintf("miniaudio result %d", e.Code)
}
}
func (e *VersionMismatchError) Error() string {
if e == nil {
return "<nil>"
}
return fmt.Sprintf(
"mago: loaded miniaudio version mismatch: expected %s (%s), got %s (%s)",
e.Expected.String(),
e.ExpectedString,
e.Actual.String(),
e.ActualString,
)
}