diff options
Diffstat (limited to 'VNLib.Data.Caching/src/Exceptions')
3 files changed, 88 insertions, 0 deletions
diff --git a/VNLib.Data.Caching/src/Exceptions/InvalidStatusException.cs b/VNLib.Data.Caching/src/Exceptions/InvalidStatusException.cs new file mode 100644 index 0000000..f5e35f4 --- /dev/null +++ b/VNLib.Data.Caching/src/Exceptions/InvalidStatusException.cs @@ -0,0 +1,39 @@ +using System; + +using VNLib.Net.Messaging.FBM; + +namespace VNLib.Data.Caching.Exceptions +{ + /// <summary> + /// Raised when the response status code of an FBM Request message is not valid for + /// the specified request + /// </summary> + public class InvalidStatusException : InvalidResponseException + { + private readonly string? StatusCode; + /// <summary> + /// Initalizes a new <see cref="InvalidStatusException"/> with the specfied status code + /// </summary> + /// <param name="message"></param> + /// <param name="statusCode"></param> + public InvalidStatusException(string message, string statusCode):this(message) + { + this.StatusCode = statusCode; + } + + ///<inheritdoc/> + public InvalidStatusException() + { + } + ///<inheritdoc/> + public InvalidStatusException(string message) : base(message) + { + } + ///<inheritdoc/> + public InvalidStatusException(string message, Exception innerException) : base(message, innerException) + { + } + ///<inheritdoc/> + public override string Message => $"InvalidStatusException: Status Code {StatusCode} \r\n {base.Message}"; + } +} diff --git a/VNLib.Data.Caching/src/Exceptions/MessageTooLargeException.cs b/VNLib.Data.Caching/src/Exceptions/MessageTooLargeException.cs new file mode 100644 index 0000000..e8f19c5 --- /dev/null +++ b/VNLib.Data.Caching/src/Exceptions/MessageTooLargeException.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.Serialization; + +using VNLib.Net.Messaging.FBM; + +namespace VNLib.Data.Caching.Exceptions +{ + /// <summary> + /// Raised when a request (or server response) calculates the size of the message to be too large to proccess + /// </summary> + public class MessageTooLargeException : FBMException + { + ///<inheritdoc/> + public MessageTooLargeException() + {} + ///<inheritdoc/> + public MessageTooLargeException(string message) : base(message) + {} + ///<inheritdoc/> + public MessageTooLargeException(string message, Exception innerException) : base(message, innerException) + {} + ///<inheritdoc/> + protected MessageTooLargeException(SerializationInfo info, StreamingContext context) : base(info, context) + {} + } +} diff --git a/VNLib.Data.Caching/src/Exceptions/ObjectNotFoundException.cs b/VNLib.Data.Caching/src/Exceptions/ObjectNotFoundException.cs new file mode 100644 index 0000000..fb284f3 --- /dev/null +++ b/VNLib.Data.Caching/src/Exceptions/ObjectNotFoundException.cs @@ -0,0 +1,23 @@ +using System; + +namespace VNLib.Data.Caching.Exceptions +{ + /// <summary> + /// Raised when a command was executed on a desired object in the remote cache + /// but the object was not found + /// </summary> + public class ObjectNotFoundException : InvalidStatusException + { + internal ObjectNotFoundException() + {} + + internal ObjectNotFoundException(string message) : base(message) + {} + + internal ObjectNotFoundException(string message, string statusCode) : base(message, statusCode) + {} + + internal ObjectNotFoundException(string message, Exception innerException) : base(message, innerException) + {} + } +} |