errors handler

This commit is contained in:
Sense T
2024-04-09 21:53:12 +08:00
parent 9752e7d9ae
commit 61395ab61b
2 changed files with 13 additions and 5 deletions

View File

@@ -2,12 +2,14 @@ package models
import (
"encoding/json"
"fmt"
"errors"
"strings"
dns "github.com/cloud66-oss/coredns_mysql"
)
var ErrorZoneNotEndWithDot = errors.New("zone should end with '.'")
const (
RecordTypeA = "A"
RecordTypeAAAA = "AAAA"
@@ -41,7 +43,7 @@ func (Record[T]) TableName() string {
func (r Record[T]) CheckZone() error {
if strings.HasSuffix(r.Zone, ".") {
return fmt.Errorf("zone should end with '.'")
return ErrorZoneNotEndWithDot
}
return nil
}