You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProxyException.cs 1.5 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Shadowsocks.Util.SystemProxy
  8. {
  9. enum ProxyExceptionType
  10. {
  11. Unspecific,
  12. FailToRun,
  13. QueryReturnEmpty,
  14. SysproxyExitError,
  15. QueryReturnMalformed
  16. }
  17. class ProxyException : Exception
  18. {
  19. // provide more specific information about exception
  20. public ProxyExceptionType Type { get; }
  21. public ProxyException()
  22. {
  23. }
  24. public ProxyException(string message) : base(message)
  25. {
  26. }
  27. public ProxyException(string message, Exception innerException) : base(message, innerException)
  28. {
  29. }
  30. protected ProxyException(SerializationInfo info, StreamingContext context) : base(info, context)
  31. {
  32. }
  33. public ProxyException(ProxyExceptionType type)
  34. {
  35. this.Type = type;
  36. }
  37. public ProxyException(ProxyExceptionType type, string message) : base(message)
  38. {
  39. this.Type = type;
  40. }
  41. public ProxyException(ProxyExceptionType type, string message, Exception innerException) : base(message, innerException)
  42. {
  43. this.Type = type;
  44. }
  45. protected ProxyException(ProxyExceptionType type, SerializationInfo info, StreamingContext context) : base(info, context)
  46. {
  47. this.Type = type;
  48. }
  49. }
  50. }