0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-12 19:39:35 +03:00

Errors: Add PrintRemovedFeatureError & PrintDeprecatedFeatureWarning (#3804)

This commit is contained in:
Kobe Arthur Scofield
2024-09-15 12:55:54 +08:00
committed by GitHub
parent 3fed0c773f
commit 5f0642a671
8 changed files with 32 additions and 25 deletions

View File

@ -0,0 +1,25 @@
package errors
import (
"context"
)
// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
// Do not remove this function even there is no reference to it.
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
if len(migrateFeature) > 0 {
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.")
} else {
LogWarning(context.Background(), "This feature " + feature + " is deprecated. Please update your config(s) according to release note and documentation before removal.")
}
}
// 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.
// Do not remove this function even there is no reference to it.
func PrintRemovedFeatureError(feature string, migrateFeature string) (error) {
if len(migrateFeature) > 0 {
return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.")
} else {
return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.")
}
}