// detectErr determines whether postgres' error needs any additional
// modifications or not.
detectErr determines whether postgres' error needs any additional
modifications or not.
// detectErr determines whether postgres ' error needs any additional // modifications or not .
func detectErr(err error) error {
	if errors.Is(err, sql.ErrNoRows) {
		return httpflow.ErrNotFound
	}
	var perr *pq.Error
	if errors.As(err, &perr) && perr.Constraint == "email_unique" {
		return httpflow.NewError(nil, http.StatusBadRequest, "email address cannot be used")
	}
	return err
}
func detectErr ( err error ) error { if errors . Is ( err , sql . ErrNoRows ) { return httpflow . ErrNotFound } var perr * pq . Error if errors . As ( err , & perr ) && perr . Constraint == " " { return httpflow . NewError ( nil , http . StatusBadRequest , " " ) } return err }
detectErr determines whether postgres' error needs any additional
modifications or not.
detectErr determines whether postgres ' error needs any additional modifications or not .