1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

refactor(server): use httperror.NewError instead of struct [EE-6189] (#10398)

This commit is contained in:
Chaim Lev-Ari 2023-10-05 11:26:24 +03:00 committed by GitHub
parent da346cba60
commit 95f3cf6e5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 39 additions and 35 deletions

View file

@ -35,13 +35,13 @@ func (handler *Handler) webhookInvoke(w http.ResponseWriter, r *http.Request) *h
statusCode = http.StatusNotFound
}
return &httperror.HandlerError{StatusCode: statusCode, Message: "Unable to find the stack by webhook ID", Err: err}
return httperror.NewError(statusCode, "Unable to find the stack by webhook ID", err)
}
if err = deployments.RedeployWhenChanged(stack.ID, handler.StackDeployer, handler.DataStore, handler.GitService); err != nil {
var StackAuthorMissingErr *deployments.StackAuthorMissingErr
if errors.As(err, &StackAuthorMissingErr) {
return &httperror.HandlerError{StatusCode: http.StatusConflict, Message: "Autoupdate for the stack isn't available", Err: err}
return httperror.Conflict("Autoupdate for the stack isn't available", err)
}
return httperror.InternalServerError("Failed to update the stack", err)