forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
- Loading branch information
1 parent
70cc9d9
commit 88277c1
Showing
2 changed files
with
47 additions
and
6 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,33 @@ | ||
/** | ||
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0 | ||
*/ | ||
|
||
using static Glide.AsyncClient; | ||
|
||
namespace Glide; | ||
|
||
public abstract class Errors | ||
{ | ||
public sealed class UnspecifiedException : Exception | ||
{ | ||
internal UnspecifiedException(string? message) : base(message) { } | ||
} | ||
|
||
public sealed class ExecutionAbortedException : Exception | ||
{ | ||
internal ExecutionAbortedException(string? message) : base(message) { } | ||
} | ||
|
||
public sealed class DisconnectedException : Exception | ||
{ | ||
internal DisconnectedException(string? message) : base(message) { } | ||
} | ||
|
||
internal static Exception MakeException(ErrorType type, string? message) => type switch | ||
{ | ||
ErrorType.ExecAbort => new ExecutionAbortedException(message), | ||
ErrorType.Disconnect => new DisconnectedException(message), | ||
ErrorType.Timeout => new TimeoutException(message), | ||
_ => new UnspecifiedException(message), | ||
}; | ||
} |