1- from open_feature .flag_evaluation .error_code import ErrorCode
1+ import typing
2+
3+ from open_feature .exception .error_code import ErrorCode
24
35
46class OpenFeatureError (Exception ):
@@ -7,13 +9,14 @@ class OpenFeatureError(Exception):
79 the more specific exceptions extending this one should be used.
810 """
911
10- def __init__ (self , error_message : str = None , error_code : ErrorCode = None ):
12+ def __init__ (
13+ self , error_message : typing .Optional [str ] = None , error_code : ErrorCode = None
14+ ):
1115 """
1216 Constructor for the generic OpenFeatureError.
13- @param error_message: a string message representing why the error has been
14- raised
17+ @param error_message: an optional string message representing why the
18+ error has been raised
1519 @param error_code: the ErrorCode string enum value for the type of error
16- @return: the generic OpenFeatureError exception
1720 """
1821 self .error_message = error_message
1922 self .error_code = error_code
@@ -25,13 +28,12 @@ class FlagNotFoundError(OpenFeatureError):
2528 key provided by the user.
2629 """
2730
28- def __init__ (self , error_message : str = None ):
31+ def __init__ (self , error_message : typing . Optional [ str ] = None ):
2932 """
3033 Constructor for the FlagNotFoundError. The error code for
3134 this type of exception is ErrorCode.FLAG_NOT_FOUND.
32- @param error_message: a string message representing why the error has been
33- raised
34- @return: the generic FlagNotFoundError exception
35+ @param error_message: an optional string message representing
36+ why the error has been raised
3537 """
3638 super ().__init__ (error_message , ErrorCode .FLAG_NOT_FOUND )
3739
@@ -42,13 +44,12 @@ class GeneralError(OpenFeatureError):
4244 feature python sdk.
4345 """
4446
45- def __init__ (self , error_message : str = None ):
47+ def __init__ (self , error_message : typing . Optional [ str ] = None ):
4648 """
4749 Constructor for the GeneralError. The error code for this type of exception
4850 is ErrorCode.GENERAL.
49- @param error_message: a string message representing why the error has been
50- raised
51- @return: the generic GeneralError exception
51+ @param error_message: an optional string message representing why the error
52+ has been raised
5253 """
5354 super ().__init__ (error_message , ErrorCode .GENERAL )
5455
@@ -59,13 +60,12 @@ class ParseError(OpenFeatureError):
5960 be parsed into a FlagEvaluationDetails object.
6061 """
6162
62- def __init__ (self , error_message : str = None ):
63+ def __init__ (self , error_message : typing . Optional [ str ] = None ):
6364 """
6465 Constructor for the ParseError. The error code for this type of exception
6566 is ErrorCode.PARSE_ERROR.
66- @param error_message: a string message representing why the error has been
67- raised
68- @return: the generic ParseError exception
67+ @param error_message: an optional string message representing why the
68+ error has been raised
6969 """
7070 super ().__init__ (error_message , ErrorCode .PARSE_ERROR )
7171
@@ -76,13 +76,12 @@ class TypeMismatchError(OpenFeatureError):
7676 not match the type requested by the user.
7777 """
7878
79- def __init__ (self , error_message : str = None ):
79+ def __init__ (self , error_message : typing . Optional [ str ] = None ):
8080 """
8181 Constructor for the TypeMismatchError. The error code for this type of
8282 exception is ErrorCode.TYPE_MISMATCH.
83- @param error_message: a string message representing why the error has been
84- raised
85- @return: the generic TypeMismatchError exception
83+ @param error_message: an optional string message representing why the
84+ error has been raised
8685 """
8786 super ().__init__ (error_message , ErrorCode .TYPE_MISMATCH )
8887
0 commit comments