1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

chore(handlers): replace structs by functions for HTTP errors EE-4227 (#7664)

This commit is contained in:
andres-portainer 2022-09-14 20:42:39 -03:00 committed by GitHub
parent 7accdf704c
commit 9ef5636718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
157 changed files with 1123 additions and 1147 deletions

View file

@ -2,7 +2,6 @@ package stacks
import (
"log"
"net/http"
"time"
httperror "github.com/portainer/libhttp/error"
@ -15,7 +14,7 @@ import (
func startAutoupdate(stackID portainer.StackID, interval string, scheduler *scheduler.Scheduler, stackDeployer stacks.StackDeployer, datastore dataservices.DataStore, gitService portainer.GitService) (jobID string, e *httperror.HandlerError) {
d, err := time.ParseDuration(interval)
if err != nil {
return "", &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Unable to parse stack's auto update interval", Err: err}
return "", httperror.BadRequest("Unable to parse stack's auto update interval", err)
}
jobID = scheduler.StartJobEvery(d, func() error {
@ -33,5 +32,4 @@ func stopAutoupdate(stackID portainer.StackID, jobID string, scheduler scheduler
if err := scheduler.StopJob(jobID); err != nil {
log.Printf("[WARN] could not stop the job for the stack %v", stackID)
}
}