-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
31 lines (24 loc) · 813 Bytes
/
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
package utils
import "fmt"
// NotFoundError represents the specific error NotFound (useful when something cannot be found, like an activity)
type NotFoundError struct {
Err string
}
type ReportNotImplementedError struct {
Err string
}
// NewNotFoundError creates a new not found error
func NewNotFoundError(err string) *NotFoundError {
return &NotFoundError{Err: err}
}
// NewReportNotImplementedError creates a new not found error
func NewReportNotImplementedError() *ReportNotImplementedError {
return &ReportNotImplementedError{}
}
// Error implements the Error method from the error interface
func (err *NotFoundError) Error() string {
return fmt.Sprintf("NotFound Error: %s", err.Err)
}
func (err *ReportNotImplementedError) Error() string {
return "This report format is not implemented yet"
}