mirror of
https://github.com/portainer/portainer.git
synced 2025-07-18 21:09:40 +02:00
fix(edgestackstatus): improve error handling BE-11963 (#844)
This commit is contained in:
parent
b6f3682a62
commit
cf5990ccba
2 changed files with 6 additions and 2 deletions
|
@ -133,7 +133,9 @@ func (handler *Handler) updateEdgeStackStatus(tx dataservices.DataStoreTx, stack
|
||||||
}
|
}
|
||||||
|
|
||||||
environmentStatus, err := tx.EdgeStackStatus().Read(stackID, payload.EndpointID)
|
environmentStatus, err := tx.EdgeStackStatus().Read(stackID, payload.EndpointID)
|
||||||
if err != nil {
|
if err != nil && !tx.IsErrObjectNotFound(err) {
|
||||||
|
return err
|
||||||
|
} else if tx.IsErrObjectNotFound(err) {
|
||||||
environmentStatus = &portainer.EdgeStackStatusForEnv{
|
environmentStatus = &portainer.EdgeStackStatusForEnv{
|
||||||
EndpointID: payload.EndpointID,
|
EndpointID: payload.EndpointID,
|
||||||
Status: []portainer.EdgeStackDeploymentStatus{},
|
Status: []portainer.EdgeStackDeploymentStatus{},
|
||||||
|
|
|
@ -297,7 +297,9 @@ func filterEndpointsByEdgeStack(endpoints []portainer.Endpoint, edgeStackId port
|
||||||
n := 0
|
n := 0
|
||||||
for _, envId := range envIds {
|
for _, envId := range envIds {
|
||||||
edgeStackStatus, err := datastore.EdgeStackStatus().Read(edgeStackId, envId)
|
edgeStackStatus, err := datastore.EdgeStackStatus().Read(edgeStackId, envId)
|
||||||
if err != nil {
|
if dataservices.IsErrObjectNotFound(err) {
|
||||||
|
continue
|
||||||
|
} else if err != nil {
|
||||||
return nil, errors.WithMessagef(err, "Unable to retrieve edge stack status for environment %d", envId)
|
return nil, errors.WithMessagef(err, "Unable to retrieve edge stack status for environment %d", envId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue