init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package apperrorsx
import "wucher/internal/transport/http/jsonapi"
// AppError is the canonical backend error contract used by translators and writers.
type AppError struct {
Status int
Code string
ErrorCode string
Title string
Message string
Detail any
Source *jsonapi.ErrorSource
Cause error
}
func (e *AppError) Error() string {
if e == nil {
return ""
}
if e.Message != "" {
return e.Message
}
if e.Cause != nil {
return e.Cause.Error()
}
return e.Code
}
func (e *AppError) WithCause(err error) *AppError {
if e == nil {
return nil
}
e.Cause = err
return e
}