优化错误处理相关代码

This commit is contained in:
GoEdgeLab
2023-08-11 14:38:00 +08:00
parent 9396fa5094
commit 85b6692548
17 changed files with 87 additions and 76 deletions

View File

@@ -3,6 +3,7 @@ package caches
import (
"encoding/binary"
"errors"
"fmt"
rangeutils "github.com/TeaOSLab/EdgeNode/internal/utils/ranges"
"github.com/iwind/TeaGo/types"
"io"
@@ -46,7 +47,7 @@ func (this *PartialFileReader) InitAutoDiscard(autoDiscard bool) error {
// 读取Range
ranges, err := NewPartialRangesFromFile(this.rangePath)
if err != nil {
return errors.New("read ranges failed: " + err.Error())
return fmt.Errorf("read ranges failed: %w", err)
}
this.ranges = ranges