diff --git a/species.go b/species.go index 7a50353..a7df4ff 100644 --- a/species.go +++ b/species.go @@ -13,10 +13,8 @@ import ( ) var ( - ErrSpeciesNotFound = errors.New("Species not found") - ErrSpeciesNotFoundJSON = newJSONError(ErrSpeciesNotFound, http.StatusNotFound) - ErrSpeciesNotUpdated = errors.New("Species not updated") - ErrSpeciesNotUpdatedJSON = newJSONError(ErrSpeciesNotUpdated, http.StatusBadRequest) + ErrSpeciesNotFound = errors.New("Species not found") + ErrSpeciesNotUpdated = errors.New("Species not updated") ) func init() { @@ -167,7 +165,7 @@ func (s SpeciesService) update(id int64, e *entity, genus string, claims *Claims return newJSONError(err, http.StatusInternalServerError) } if count != 1 { - return ErrSpeciesNotUpdatedJSON + return newJSONError(ErrSpeciesNotUpdated, http.StatusBadRequest) } // Reload to send back down the wire diff --git a/strains.go b/strains.go index 921dd3f..331346a 100644 --- a/strains.go +++ b/strains.go @@ -13,10 +13,8 @@ import ( ) var ( - ErrStrainNotFound = errors.New("Strain not found") - ErrStrainNotFoundJSON = newJSONError(ErrStrainNotFound, http.StatusNotFound) - ErrStrainNotUpdated = errors.New("Strain not updated") - ErrStrainNotUpdatedJSON = newJSONError(ErrStrainNotUpdated, http.StatusBadRequest) + ErrStrainNotFound = errors.New("Strain not found") + ErrStrainNotUpdated = errors.New("Strain not updated") ) func init() { @@ -165,7 +163,7 @@ func (s StrainService) update(id int64, e *entity, genus string, claims *Claims) return newJSONError(err, http.StatusInternalServerError) } if count != 1 { - return ErrStrainNotUpdatedJSON + return newJSONError(ErrStrainNotUpdated, http.StatusBadRequest) } strain, err := getStrain(id, genus, claims)