Installer: Handle VM uninstall before it has had a time to boot

Change-Id: I615bc949b5054b301899b1e0b7eae94a98126e61
diff --git a/core/headscale/main.go b/core/headscale/main.go
index 194da06..c2cfcf5 100644
--- a/core/headscale/main.go
+++ b/core/headscale/main.go
@@ -167,7 +167,11 @@
 		return
 	}
 	if err := s.client.expirePreAuthKey(user, req.AuthKey); err != nil {
-		http.Error(w, err.Error(), http.StatusInternalServerError)
+		if errors.Is(err, ErrorNotFound) {
+			http.Error(w, err.Error(), http.StatusNotFound)
+		} else {
+			http.Error(w, err.Error(), http.StatusInternalServerError)
+		}
 		return
 	}
 }
@@ -185,8 +189,11 @@
 		return
 	}
 	if err := s.client.expireUserNode(user, node); err != nil {
-		fmt.Println(err)
-		http.Error(w, err.Error(), http.StatusInternalServerError)
+		if errors.Is(err, ErrorNotFound) {
+			http.Error(w, err.Error(), http.StatusNotFound)
+		} else {
+			http.Error(w, err.Error(), http.StatusInternalServerError)
+		}
 		return
 	}
 }
@@ -203,7 +210,11 @@
 		return
 	}
 	if err := s.client.removeUserNode(user, node); err != nil {
-		http.Error(w, err.Error(), http.StatusInternalServerError)
+		if errors.Is(err, ErrorNotFound) {
+			http.Error(w, err.Error(), http.StatusNotFound)
+		} else {
+			http.Error(w, err.Error(), http.StatusInternalServerError)
+		}
 		return
 	}
 }