2024-11-23 16:08:17 +08:00
|
|
|
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 {
|
2024-11-23 17:32:33 +08:00
|
|
|
return NewApiExceptin(ERR_NOT_FOUND, fmt.Sprintf(format, a...)).WithHttpCode(404)
|
2024-11-23 16:08:17 +08:00
|
|
|
}
|