Cleanup errors
This commit is contained in:
parent
1ba602b1e2
commit
2ad00f9aa7
2 changed files with 6 additions and 10 deletions
|
@ -14,9 +14,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrSpeciesNotFound = errors.New("Species not found")
|
ErrSpeciesNotFound = errors.New("Species not found")
|
||||||
ErrSpeciesNotFoundJSON = newJSONError(ErrSpeciesNotFound, http.StatusNotFound)
|
|
||||||
ErrSpeciesNotUpdated = errors.New("Species not updated")
|
ErrSpeciesNotUpdated = errors.New("Species not updated")
|
||||||
ErrSpeciesNotUpdatedJSON = newJSONError(ErrSpeciesNotUpdated, http.StatusBadRequest)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -167,7 +165,7 @@ func (s SpeciesService) update(id int64, e *entity, genus string, claims *Claims
|
||||||
return newJSONError(err, http.StatusInternalServerError)
|
return newJSONError(err, http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
if count != 1 {
|
if count != 1 {
|
||||||
return ErrSpeciesNotUpdatedJSON
|
return newJSONError(ErrSpeciesNotUpdated, http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload to send back down the wire
|
// Reload to send back down the wire
|
||||||
|
|
|
@ -14,9 +14,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrStrainNotFound = errors.New("Strain not found")
|
ErrStrainNotFound = errors.New("Strain not found")
|
||||||
ErrStrainNotFoundJSON = newJSONError(ErrStrainNotFound, http.StatusNotFound)
|
|
||||||
ErrStrainNotUpdated = errors.New("Strain not updated")
|
ErrStrainNotUpdated = errors.New("Strain not updated")
|
||||||
ErrStrainNotUpdatedJSON = newJSONError(ErrStrainNotUpdated, http.StatusBadRequest)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -165,7 +163,7 @@ func (s StrainService) update(id int64, e *entity, genus string, claims *Claims)
|
||||||
return newJSONError(err, http.StatusInternalServerError)
|
return newJSONError(err, http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
if count != 1 {
|
if count != 1 {
|
||||||
return ErrStrainNotUpdatedJSON
|
return newJSONError(ErrStrainNotUpdated, http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
strain, err := getStrain(id, genus, claims)
|
strain, err := getStrain(id, genus, claims)
|
||||||
|
|
Reference in a new issue