feature_errors.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. package errors
  2. import (
  3. "context"
  4. )
  5. // PrintMigrateFeatureInfo prints a notice of the upcoming feature migration.
  6. // Place it after the source feature related config file pharser code.
  7. // Important note: Only use this when the target migrating feature is under construction.
  8. // Important note: Even when the target migrating feature has finished its construction, this notice can still be used yet before announcing deprecation of the old feature.
  9. // Do not remove this function even there is no reference to it.
  10. func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) {
  11. LogInfo(context.Background(), "The feature "+sourceFeature+" will be migrated to "+targetFeature+" in the future.")
  12. }
  13. // PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
  14. // Do not remove this function even there is no reference to it.
  15. func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
  16. if len(migrateFeature) > 0 {
  17. LogWarning(context.Background(), "This feature "+feature+" is deprecated and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
  18. } else {
  19. LogWarning(context.Background(), "This feature "+feature+" is deprecated. Please update your config(s) according to release note and documentation before removal.")
  20. }
  21. }
  22. // 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.
  23. // Do not remove this function even there is no reference to it.
  24. func PrintRemovedFeatureError(feature string, migrateFeature string) error {
  25. if len(migrateFeature) > 0 {
  26. return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.")
  27. } else {
  28. return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.")
  29. }
  30. }