-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patherrors.go
More file actions
44 lines (34 loc) · 1.03 KB
/
errors.go
File metadata and controls
44 lines (34 loc) · 1.03 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
package mux
import "fmt"
// BadRouteError creates error for a bad route
type BadRouteError struct {
r RouteInterface
s string
}
func NewBadRouteError(r RouteInterface, s string) *BadRouteError {
return &BadRouteError{
r: r,
s: s,
}
}
func (bre BadRouteError) Error() string {
return fmt.Sprintf("Route -> Method: %s Path: %s Error: %s", bre.r.GetMethodName(), bre.r.GetPath(), bre.s)
}
// BadMethodError creates error for bad method
type BadMethodError struct {
s string
}
func (bme *BadMethodError) Error() string { return fmt.Sprintf("Method not vaild (%s)", bme.s) }
// NewBadMethodError returns an error that formats as the given text.
func NewBadMethodError(text string) error {
return &BadMethodError{text}
}
// BadPathError creates error for bad path
type BadPathError struct {
s string
}
func (bme *BadPathError) Error() string { return fmt.Sprintf("Path is invaild (%s)", bme.s) }
// NewBadPathError returns an error that formats as the given text.
func NewBadPathError(text string) error {
return &BadPathError{s: text}
}