20 lines
335 B
Go
20 lines
335 B
Go
package exception
|
|
|
|
import "fmt"
|
|
|
|
const (
|
|
ERR_NOT_FOUND = 404
|
|
)
|
|
|
|
func IsNotFound(err error) bool {
|
|
if v, ok := (err).(*ApiExceptin); ok {
|
|
return v.Code == ERR_NOT_FOUND
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func ErrNotFound(format string, a ...any) *ApiExceptin {
|
|
return NewApiExceptin(ERR_NOT_FOUND, fmt.Sprintf(format, a...)).WithHttpCode(404)
|
|
}
|