mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
优化错误处理相关代码
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/cloudflare"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/dnstypes"
|
||||
@@ -337,7 +338,7 @@ func (this *CloudFlareProvider) doAPI(method string, apiPath string, args map[st
|
||||
|
||||
err = json.Unmarshal(data, respPtr)
|
||||
if err != nil {
|
||||
return errors.New("decode json failed: " + err.Error() + ", response text: " + string(data))
|
||||
return fmt.Errorf("decode json failed: %w, response text: %s", err, string(data))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user