v0.0.188 exerr MVP

This commit is contained in:
2023-07-24 10:42:39 +02:00
parent b1d6509294
commit 2e6ca48d22
14 changed files with 660 additions and 118 deletions

View File

@@ -1,5 +1,10 @@
package exerr
import (
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"net/http"
)
type ErrorCategory struct{ Category string }
var (
@@ -24,9 +29,22 @@ var (
var AllSeverities = []ErrorSeverity{SevTrace, SevDebug, SevInfo, SevWarn, SevErr, SevFatal}
type ErrorType struct{ Key string }
type ErrorType struct {
Key string
DefaultStatusCode *int
}
var (
TypeInternal = ErrorType{"Internal"}
TypeInternal = ErrorType{"Internal", langext.Ptr(http.StatusInternalServerError)}
TypePanic = ErrorType{"Panic", langext.Ptr(http.StatusInternalServerError)}
TypeWrap = ErrorType{"Wrap", nil}
// other values come from pkgconfig
)
type LogPrintLevel string
const (
LogPrintFull LogPrintLevel = "Full"
LogPrintOverview LogPrintLevel = "Overview"
LogPrintShort LogPrintLevel = "Short"
)