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 }