Skip to content

Commit

Permalink
networks: return HTTP 404 for sql.ErrNoRows
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed May 20, 2020
1 parent d83a7da commit 72c23e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/compute/models/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,11 @@ func (manager *SNetworkManager) validateEnsureWire(ctx context.Context, userCred
}

func (manager *SNetworkManager) validateEnsureZoneVpc(ctx context.Context, userCred mcclient.TokenCredential, input api.NetworkCreateInput) (w *SWire, v *SVpc, cr *SCloudregion, err error) {
defer func() {
if cause := errors.Cause(err); cause == sql.ErrNoRows {
err = httperrors.NewResourceNotFoundError("%s", err)
}
}()
zObj, err := ZoneManager.FetchByIdOrName(userCred, input.Zone)
if err != nil {
err = errors.Wrapf(err, "zone %s", input.Zone)
Expand Down

0 comments on commit 72c23e8

Please sign in to comment.