code: func FormatError(err error) string {
  	perr, ok := err.(cty.PathError)
  	if !ok || len(perr.Path) == 0 {
  		return err.Error()
  	}
  
  	return fmt.Sprintf("%s: %s", FormatCtyPath(perr.Path), perr.Error())
  }
docs: // FormatError is a helper function to produce a user-friendly string
  // representation of certain special error types that we might want to
  // include in diagnostic messages.
  //
  // This currently has special behavior only for cty.PathError, where a
  // non-empty path is rendered in a HCL-like syntax as context.