-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split errors to classes by types (#115)
Signed-off-by: Valentinas <31697821+valentk777@users.noreply.github.com>
- Loading branch information
1 parent
bd730a5
commit 5f348f4
Showing
8 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Provider was unable to find the flag error when evaluating a flag. | ||
/// </summary> | ||
public class FlagNotFoundException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="FlagNotFoundException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public FlagNotFoundException(string message = null, Exception innerException = null) | ||
: base(ErrorType.FlagNotFound, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Abnormal execution of the provider when evaluating a flag. | ||
/// </summary> | ||
public class GeneralException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="GeneralException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public GeneralException(string message = null, Exception innerException = null) | ||
: base(ErrorType.General, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Context does not satisfy provider requirements when evaluating a flag. | ||
/// </summary> | ||
public class InvalidContextException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="InvalidContextException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public InvalidContextException(string message = null, Exception innerException = null) | ||
: base(ErrorType.InvalidContext, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Provider failed to parse the flag response when evaluating a flag. | ||
/// </summary> | ||
public class ParseErrorException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="ParseErrorException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public ParseErrorException(string message = null, Exception innerException = null) | ||
: base(ErrorType.ParseError, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Provider has yet been initialized when evaluating a flag. | ||
/// </summary> | ||
public class ProviderNotReadyException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="ProviderNotReadyException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public ProviderNotReadyException(string message = null, Exception innerException = null) | ||
: base(ErrorType.ProviderNotReady, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Context does not contain a targeting key and the provider requires one when evaluating a flag. | ||
/// </summary> | ||
public class TargetingKeyMissingException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="TargetingKeyMissingException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public TargetingKeyMissingException(string message = null, Exception innerException = null) | ||
: base(ErrorType.TargetingKeyMissing, message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Error | ||
{ | ||
/// <summary> | ||
/// Request type does not match the expected type when evaluating a flag. | ||
/// </summary> | ||
public class TypeMismatchException : FeatureProviderException | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of the <see cref="TypeMismatchException"/> class | ||
/// </summary> | ||
/// <param name="message">Exception message</param> | ||
/// <param name="innerException">Optional inner exception</param> | ||
public TypeMismatchException(string message = null, Exception innerException = null) | ||
: base(ErrorType.TypeMismatch, message, innerException) | ||
{ | ||
} | ||
} | ||
} |