Add error to GetSession return values

- Add button to copy instance SSH access
This commit is contained in:
marcos
2017-12-14 17:37:38 -03:00
parent 3ffaaaf934
commit dd6a332889
17 changed files with 94 additions and 26 deletions

View File

@@ -5,16 +5,20 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/play-with-docker/play-with-docker/storage"
)
func CloseSession(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
sessionId := vars["sessionId"]
session := core.SessionGet(sessionId)
if session == nil {
session, err := core.SessionGet(sessionId)
if err == storage.NotFoundError {
rw.WriteHeader(http.StatusNotFound)
return
} else if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
return
}
if err := core.SessionClose(session); err != nil {