Files
crawlab/core/errors/base.go
2024-06-14 15:42:50 +08:00

34 lines
808 B
Go

package errors
import (
"errors"
"fmt"
)
const (
ErrorPrefixController = "controller"
ErrorPrefixModel = "model"
ErrorPrefixFilter = "filter"
ErrorPrefixHttp = "http"
ErrorPrefixGrpc = "grpc"
ErrorPrefixNode = "node"
ErrorPrefixInject = "inject"
ErrorPrefixSpider = "spider"
ErrorPrefixFs = "fs"
ErrorPrefixTask = "task"
ErrorPrefixSchedule = "schedule"
ErrorPrefixUser = "user"
ErrorPrefixStats = "stats"
ErrorPrefixEvent = "event"
ErrorPrefixProcess = "process"
ErrorPrefixGit = "git"
ErrorPrefixResult = "result"
ErrorPrefixDataSource = "data_source"
)
type ErrorPrefix string
func NewError(prefix ErrorPrefix, msg string) (err error) {
return errors.New(fmt.Sprintf("%s error: %s", prefix, msg))
}