restructure hardlink layout

This commit is contained in:
2026-05-14 12:20:25 +01:00
parent af151fd389
commit b982698ccd
26 changed files with 38 additions and 35 deletions
+30
View File
@@ -0,0 +1,30 @@
package errorhandlers
import (
"encoding/json"
"fmt"
"net/http"
"os"
"gitea.futuresens.co.uk/futuresens/cmstypes"
log "github.com/sirupsen/logrus"
)
// writeError is a helper to send a JSON error and HTTP status in one go.
func WriteError(w http.ResponseWriter, status int, msg string) {
theResponse := cmstypes.StatusRec{
Code: status,
Message: msg,
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
json.NewEncoder(w).Encode(theResponse)
}
func FatalError(err error) {
fmt.Println(err.Error())
log.Errorf(err.Error())
fmt.Println(". Press Enter to exit...")
fmt.Scanln()
os.Exit(1)
}