-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
60 lines (47 loc) · 1.14 KB
/
error.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
/*
* Author: fasion
* Created time: 2022-11-02 21:47:37
* Last Modified by: fasion
* Last Modified time: 2022-12-25 17:57:21
*/
package baseutils
import "fmt"
type EnvironmentVariableNotFoundError struct {
name string
}
func NewEnvironmentVariableNotFoundError(name string) EnvironmentVariableNotFoundError {
return EnvironmentVariableNotFoundError{
name: name,
}
}
func (e EnvironmentVariableNotFoundError) Name() string {
return e.name
}
func (e EnvironmentVariableNotFoundError) Error() string {
return fmt.Sprintf("environment variable not found: %s", e.name)
}
type CookieNotFoundError struct {
name string
}
func NewCookieNotFoundError(name string) CookieNotFoundError {
return CookieNotFoundError{
name: name,
}
}
func (e CookieNotFoundError) Name() string {
return e.name
}
func (e CookieNotFoundError) Error() string {
return fmt.Sprintf("cookie not found: %s", e.name)
}
type NotImplementedError struct {
hint string
}
func NewNotImplementedError(hint string) NotImplementedError {
return NotImplementedError{
hint: hint,
}
}
func (e NotImplementedError) Error() string {
return fmt.Sprintf("not implemented: %s", e.hint)
}