mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
34 lines
808 B
Go
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))
|
|
}
|