mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-05 08:30:26 +08:00
优化错误处理相关代码
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/dnstypes"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/edgeapi"
|
||||
@@ -452,7 +453,7 @@ func (this *EdgeDNSAPIProvider) doAPI(path string, params map[string]any, respPt
|
||||
|
||||
err = json.Unmarshal(data, respPtr)
|
||||
if err != nil {
|
||||
return errors.New("decode response failed: " + err.Error() + ", JSON: " + string(data))
|
||||
return fmt.Errorf("decode response failed: %w, JSON: %s", err, string(data))
|
||||
}
|
||||
|
||||
if !respPtr.IsValid() {
|
||||
|
||||
Reference in New Issue
Block a user