feature_errors.go 1.8 KB

12345678910111213141516171819202122232425262728293031
  1. package errors
  2. import (
  3. "context"
  4. )
  5. // PrintNonRemovalDeprecatedFeatureWarning prints a warning of the deprecated feature that won't be removed in the near future.
  6. // Do not remove this function even there is no reference to it.
  7. func PrintNonRemovalDeprecatedFeatureWarning(sourceFeature string, targetFeature string) {
  8. LogWarning(context.Background(), "The feature "+sourceFeature+" is deprecated, not recommended for using and might be removed. Please migrate to "+targetFeature+" as soon as possible.")
  9. }
  10. // PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
  11. // Do not remove this function even there is no reference to it.
  12. func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
  13. if len(migrateFeature) > 0 {
  14. LogWarning(context.Background(), "This feature "+feature+" is deprecated, will be removed soon and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
  15. } else {
  16. LogWarning(context.Background(), "This feature "+feature+" is deprecated and will be removed soon. Please update your config(s) according to release note and documentation before removal.")
  17. }
  18. }
  19. // PrintRemovedFeatureError prints an error message for removed feature then return an error. And after long enough time the message can also be removed, uses as an indicator.
  20. // Do not remove this function even there is no reference to it.
  21. func PrintRemovedFeatureError(feature string, migrateFeature string) error {
  22. if len(migrateFeature) > 0 {
  23. return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.")
  24. } else {
  25. return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.")
  26. }
  27. }