-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.go
42 lines (34 loc) · 882 Bytes
/
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
package gondola
import (
"fmt"
"net/http"
)
// Gondola is a proxy server.
type Gondola struct {
config *Config
server *http.Server
}
// ConfigLoadError is an error that occurs when loading the configuration.
type ConfigLoadError struct {
Err error
}
// Error implements the error interface.
func (e *ConfigLoadError) Error() string {
return fmt.Sprintf("error loading config: %v", e.Err)
}
// Unwrap implements the errors.Wrapper interface.
func (e *ConfigLoadError) Unwrap() error {
return e.Err
}
// ProxyServerError is an error that occurs when creating the server.
type ProxyServerError struct {
Err error
}
// Error implements the error interface.
func (e *ProxyServerError) Error() string {
return fmt.Sprintf("error creating server: %v", e.Err)
}
// Unwrap implements the errors.Wrapper interface.
func (e *ProxyServerError) Unwrap() error {
return e.Err
}