Organize backend into product executable and shared Go modules

This commit is contained in:
Stephan D committed 2026-09-12 14:14:08 +02:00
1 parent 981e84a4b4
commit f0720ec66b
382 files changed
+1944 -6989

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
package merrors
import "strings"
type classifiedError struct {
base error
code error
msg string
reason string
publicMessage bool
argumentNames []string
}
func (e classifiedError) Error() string {
if e.publicMessage {
msg := strings.TrimSpace(e.msg)
if msg != "" {
return msg
}
if e.code != nil {
return e.code.Error()
}
if e.base != nil {
return e.base.Error()
}
return ""
}
return Wrap(e.base, e.msg).Error()
}
func (e classifiedError) Unwrap() []error {
causes := make([]error, 0, 2)
if e.base != nil {
causes = append(causes, e.base)
}
if e.code != nil {
causes = append(causes, e.code)
}
return causes
}
func (e classifiedError) Reason() string {
return strings.TrimSpace(e.reason)
}
func (e classifiedError) InvalidArgumentFields() []string {
return append([]string(nil), e.argumentNames...)
}