Files
cms-server/internal/exception/error.go
2026-01-21 15:48:49 +08:00

17 lines
453 B
Go

package exception
import "log/slog"
func ErrorHandler(status string, errorCode string, err error) {
switch status {
case StatusSuccess:
slog.Info("Service exception", "id", errorCode, "err", err)
case StatusUser:
slog.Warn("Service exception", "id", errorCode, "err", err)
case StatusServer:
slog.Error("Service exception", "id", errorCode, "err", err)
case StatusClient:
slog.Error("Service exception", "id", errorCode, "err", err)
}
}