From b8c03015ef5f6de49791a65d0c4f70bab892a9e2 Mon Sep 17 00:00:00 2001
From: Arya Kiran <aryak@vern.cc>
Date: Wed, 18 Jan 2023 22:43:23 +0530
Subject: [PATCH] add internal server error for some errors

---
 main.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go
index b2a4126..3fff05b 100644
--- a/main.go
+++ b/main.go
@@ -106,17 +106,19 @@ func main() {
 		}
 		// Get the number of users online
 		usersonline, err := exec.Command("bash", "-c", "/usr/bin/users").Output()
+		if err != nil {
+			log.Error(err)
+			return c.SendStatus(fiber.StatusInternalServerError)
+		}
 		usersonlinestr := string(usersonline)
 		usersonlinededup := Dedup(usersonlinestr)
 		outputa := int(strings.Count(usersonlinededup, " "))
 		var output int
 		output = outputa + 1
-		if err != nil {
-			log.Error(err)
-		}
 		users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output()
 		if err2 != nil {
 			log.Error(err2)
+			return c.SendStatus(fiber.StatusInternalServerError)
 		}
 		userstr := string(users)
 		userstr2 := strings.TrimSuffix(userstr, "\n")