mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dnsclients
 | 
						|
 | 
						|
import (
 | 
						|
	"errors"
 | 
						|
	"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/dnstypes"
 | 
						|
	"github.com/iwind/TeaGo/types"
 | 
						|
)
 | 
						|
 | 
						|
type BaseProvider struct{}
 | 
						|
 | 
						|
// WrapError 封装解析相关错误
 | 
						|
func (this *BaseProvider) WrapError(err error, domain string, record *dnstypes.Record) error {
 | 
						|
	if err == nil {
 | 
						|
		return nil
 | 
						|
	}
 | 
						|
 | 
						|
	if record == nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
 | 
						|
	var fullname = ""
 | 
						|
	if len(record.Name) == 0 {
 | 
						|
		fullname = domain
 | 
						|
	} else {
 | 
						|
		fullname = record.Name + "." + domain
 | 
						|
	}
 | 
						|
	return errors.New("record operation failed: '" + fullname + " " + record.Type + " " + record.Value + " " + types.String(record.TTL) + "': " + err.Error())
 | 
						|
}
 |