api: Display an error if not able to perform corrections calculation

This commit is contained in:
Pierre-Olivier Mercier 2022-07-26 15:06:19 +02:00
parent a8ccdcab09
commit 014e6a3559

View File

@ -259,7 +259,7 @@ func diffZones(c *gin.Context) {
provider, err := storage.MainStore.GetProvider(user, domain.IdProvider) provider, err := storage.MainStore.GetProvider(user, domain.IdProvider)
if err != nil { if err != nil {
c.AbortWithStatusJSON(http.StatusNotFound, fmt.Errorf("Unable to find the given source: %q for %q", domain.IdProvider, domain.DomainName)) c.AbortWithStatusJSON(http.StatusNotFound, fmt.Errorf("Unable to find the given provider: %q for %q", domain.IdProvider, domain.DomainName))
return return
} }
@ -281,6 +281,10 @@ func diffZones(c *gin.Context) {
} }
corrections, err := provider.GetDomainCorrections(dc) corrections, err := provider.GetDomainCorrections(dc)
if err != nil {
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": err.Error()})
return
}
var rrCorected []string var rrCorected []string
for _, c := range corrections { for _, c := range corrections {