UnexpectedEndOfStreamException.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Runtime.Serialization;
  3. namespace System.Net.ApiService.Compression.Exceptions {
  4. /// <summary>
  5. /// Indicates that the input stream could not decoded due to the stream ending before enough data had been provided
  6. /// </summary>
  7. [Serializable]
  8. public class UnexpectedEndOfStreamException : StreamDecodingException
  9. {
  10. private const string GenericMessage = "Input stream ended unexpectedly";
  11. /// <summary>
  12. /// Initializes a new instance of the UnexpectedEndOfStreamException with a generic message
  13. /// </summary>
  14. public UnexpectedEndOfStreamException() : base(GenericMessage) { }
  15. /// <summary>
  16. /// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified error message.
  17. /// </summary>
  18. /// <param name="message">A message describing the exception.</param>
  19. public UnexpectedEndOfStreamException(string message) : base(message) { }
  20. /// <summary>
  21. /// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified
  22. /// error message and a reference to the inner exception that is the cause of this exception.
  23. /// </summary>
  24. /// <param name="message">A message describing the exception.</param>
  25. /// <param name="innerException">The inner exception</param>
  26. public UnexpectedEndOfStreamException(string message, Exception innerException) : base(message, innerException) { }
  27. /// <summary>
  28. /// Initializes a new instance of the UnexpectedEndOfStreamException class with serialized data.
  29. /// </summary>
  30. /// <param name="info">
  31. /// The System.Runtime.Serialization.SerializationInfo that holds the serialized
  32. /// object data about the exception being thrown.
  33. /// </param>
  34. /// <param name="context">
  35. /// The System.Runtime.Serialization.StreamingContext that contains contextual information
  36. /// about the source or destination.
  37. /// </param>
  38. protected UnexpectedEndOfStreamException(SerializationInfo info, StreamingContext context)
  39. : base(info, context)
  40. {
  41. }
  42. }
  43. }