package infra

// ErrorGoCore is the standard error type for impure functions in the infra package.
// It wraps a message string and an optional machine-readable Code, and satisfies the error interface.
type ErrorGoCore struct {
	Message string
	Code    string // optional machine-readable error code (e.g. "FETCH_ERROR", "CONVERGENCE_FAILED")
}

func (e *ErrorGoCore) Error() string {
	if e.Code != "" {
		return e.Code + ": " + e.Message
	}
	return e.Message
}
