mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Errors: Add PrintRemovedFeatureError & PrintDeprecatedFeatureWarning (#3804)
This commit is contained in:
parent
3fed0c773f
commit
5f0642a671
8 changed files with 32 additions and 25 deletions
25
common/errors/feature_errors.go
Normal file
25
common/errors/feature_errors.go
Normal 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.")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue