refactor: package

This commit is contained in:
liwei committed 2021-03-25 19:38:23 +08:00
1 parent 359f28bb1f
commit ede6a9834d
55 files changed
+279 -237

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package tracker
import (
"fmt"
)
type ErrorCode int
const (
ErrTimeout ErrorCode = -1
ErrResponse ErrorCode = -2
)
type BtError interface {
error
}
type TrackerError struct {
Code ErrorCode
Err error
}
func (te *TrackerError) Error() string {
return fmt.Sprintf("%s:%d", te.Err.Error(), te.Code)
}
func NewTrackerError(code ErrorCode, err error) *TrackerError {
return &TrackerError{code, err}
}