func getHttpDddErrorStatus(err Error, status int) string {
	if statusName := err.Status(); statusName != "" {
		return statusName
	}
	return http.StatusText(status)
}
retrieves a status name from an Error or a generic HTTP problem object type.

For more information, go to: https://datatracker.ietf.org/doc/html/rfc7807#section-4.2
package ddderr
import (
	"net/http"
)
type HttpError struct {
	Type       string `json:"type,omitempty"`
	Title      string `json:"title,omitempty"`
	Status     string `json:"status,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	Detail     string `json:"detail,omitempty"`
	Instance   string `json:"instance,omitempty"`
}
func NewHttpError(errType, instance string, err error) HttpError {
	if err == nil {
		return HttpError{}
	}
	code := http.StatusInternalServerError
	errHttpType := getHttpErrorType(errType, code)
	customErr, ok := err.(Error)
	if !ok {
		return HttpError{
			Type:       errHttpType,
			Title:      err.Error(),
			Status:     http.StatusText(code),
			StatusCode: code,
			Detail:     err.Error(),
			Instance:   instance,
		}
	}
	code = GetHttpStatusCode(customErr)
	errHttpType = getHttpErrorType(errType, code)
	return HttpError{
		Type:       errHttpType,
		Title:      customErr.Title(),
		Status:     getHttpDddErrorStatus(customErr, code),
		StatusCode: code,
		Detail:     customErr.Description(),
		Instance:   instance,
	}
}
func getHttpErrorType(rootType string, status int) string {
	if rootType != "" {
		return rootType
	}
	return http.StatusText(status)
}