refactor: rename module 'err' to 'gperr' in references

This commit is contained in:
yusing
2025-03-28 06:26:36 +08:00
parent e4f6994dfc
commit 361931ed96
38 changed files with 242 additions and 267 deletions

View File

@@ -7,7 +7,7 @@ import (
"time"
"github.com/rs/zerolog"
E "github.com/yusing/go-proxy/internal/error"
"github.com/yusing/go-proxy/internal/gperr"
"github.com/yusing/go-proxy/internal/route"
"github.com/yusing/go-proxy/internal/route/provider/types"
"github.com/yusing/go-proxy/internal/task"
@@ -28,7 +28,7 @@ type (
fmt.Stringer
ShortName() string
IsExplicitOnly() bool
loadRoutesImpl() (route.Routes, E.Error)
loadRoutesImpl() (route.Routes, gperr.Error)
NewWatcher() W.Watcher
Logger() *zerolog.Logger
}
@@ -92,10 +92,10 @@ func (p *Provider) startRoute(parent task.Parent, r *route.Route) E.Error {
}
// Start implements task.TaskStarter.
func (p *Provider) Start(parent task.Parent) E.Error {
func (p *Provider) Start(parent task.Parent) gperr.Error {
t := parent.Subtask("provider."+p.String(), false)
errs := E.NewBuilder("routes error")
errs := gperr.NewBuilder("routes error")
for _, r := range p.routes {
errs.Add(p.startRoute(t, r))
}
@@ -109,8 +109,8 @@ func (p *Provider) Start(parent task.Parent) E.Error {
handler.Handle(t, events)
handler.Log()
},
func(err E.Error) {
E.LogError("event error", err, p.Logger())
func(err gperr.Error) {
gperr.LogError("event error", err, p.Logger())
},
)
eventQueue.Start(p.watcher.Events(t.Context()))
@@ -132,12 +132,12 @@ func (p *Provider) GetRoute(alias string) (r *route.Route, ok bool) {
return
}
func (p *Provider) loadRoutes() (routes route.Routes, err E.Error) {
func (p *Provider) loadRoutes() (routes route.Routes, err gperr.Error) {
routes, err = p.loadRoutesImpl()
if err != nil && len(routes) == 0 {
return route.Routes{}, err
}
errs := E.NewBuilder("routes error")
errs := gperr.NewBuilder("routes error")
errs.Add(err)
// check for exclusion
// set alias and provider, then validate
@@ -156,7 +156,7 @@ func (p *Provider) loadRoutes() (routes route.Routes, err E.Error) {
return routes, errs.Error()
}
func (p *Provider) LoadRoutes() (err E.Error) {
func (p *Provider) LoadRoutes() (err gperr.Error) {
p.routes, err = p.loadRoutes()
return
}