mirror of
https://github.com/portainer/portainer.git
synced 2026-08-07 08:54:48 +00:00
fix(websocket): return accurate errors BE-13117 (#3276)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user