fix(websocket): return accurate errors BE-13117 (#3276)

This commit is contained in:
andres-portainer
2026-07-27 08:59:57 -03:00
committed by GitHub
parent 9e0d89c021
commit 244b0d63fe
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -50,9 +50,9 @@ func (handler *Handler) websocketAttach(w http.ResponseWriter, r *http.Request)
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if handler.DataStore.IsErrObjectNotFound(err) {
return httperror.NotFound("Unable to find the environment associated to the stack inside the database", err)
return httperror.NotFound("Unable to find the environment in the database", err)
} else if err != nil {
return httperror.InternalServerError("Unable to find the environment associated to the stack inside the database", err)
return httperror.InternalServerError("Unable to find the environment in the database", err)
}
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
+2 -2
View File
@@ -53,9 +53,9 @@ func (handler *Handler) websocketExec(w http.ResponseWriter, r *http.Request) *h
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if handler.DataStore.IsErrObjectNotFound(err) {
return httperror.NotFound("Unable to find the environment associated to the stack inside the database", err)
return httperror.NotFound("Unable to find the environment in the database", err)
} else if err != nil {
return httperror.InternalServerError("Unable to find the environment associated to the stack inside the database", err)
return httperror.InternalServerError("Unable to find the environment in the database", err)
}
err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)
+2 -2
View File
@@ -66,9 +66,9 @@ func (handler *Handler) websocketPodExec(w http.ResponseWriter, r *http.Request)
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if handler.DataStore.IsErrObjectNotFound(err) {
return httperror.NotFound("Unable to find the environment associated to the stack inside the database", err)
return httperror.NotFound("Unable to find the environment in the database", err)
} else if err != nil {
return httperror.InternalServerError("Unable to find the environment associated to the stack inside the database", err)
return httperror.InternalServerError("Unable to find the environment in the database", err)
}
if err := handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint); err != nil {
+2 -2
View File
@@ -32,9 +32,9 @@ func (handler *Handler) websocketShellPodExec(w http.ResponseWriter, r *http.Req
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if handler.DataStore.IsErrObjectNotFound(err) {
return httperror.NotFound("Unable to find the environment associated to the stack inside the database", err)
return httperror.NotFound("Unable to find the environment in the database", err)
} else if err != nil {
return httperror.InternalServerError("Unable to find the environment associated to the stack inside the database", err)
return httperror.InternalServerError("Unable to find the environment in the database", err)
}
if err := handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint); err != nil {