add internal server error for some errors

This commit is contained in:
Arya Kiran 2023-01-18 22:43:23 +05:30
parent 2b3b221baf
commit b8c03015ef
Signed by: arya
GPG Key ID: 842D12BDA50DF120
1 changed files with 5 additions and 3 deletions

View File

@ -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")