IdException.pas 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 10155: IdException.pas
  11. {
  12. { Rev 1.0 2002.11.12 10:37:50 PM czhower
  13. }
  14. unit IdException;
  15. interface
  16. uses
  17. SysUtils;
  18. type
  19. EIdException = class(Exception);
  20. TClassIdException = class of EIdException;
  21. // You can add EIdSilentException to the list of ignored exceptions to reduce debugger "trapping"
  22. // of "normal" exceptions
  23. EIdSilentException = class(EIdException);
  24. // EIdConnClosedGracefully is raised when remote side closes connection normally
  25. EIdConnClosedGracefully = class(EIdSilentException);
  26. EIdAlreadyConnected = class(EIdException);
  27. // EIdClosedSocket is raised if .Disconnect has been called and an operation is attempted
  28. // or Connect has not been called
  29. EIdClosedSocket = class(EIdException);
  30. EIdResponseError = class(EIdException);
  31. EIdReadTimeout = class(EIdException);
  32. EIdReadLnMaxLineLengthExceeded = class(EIdException);
  33. EIdInvalidServiceName = class(EIdException);
  34. // This exception is for protocol errors such as 404 HTTP error and also
  35. // SendCmd / GetResponse
  36. EIdProtocolReplyError = class(EIdException)
  37. protected
  38. FReplyErrorCode : Integer;
  39. public
  40. // Params must be in this order to avoid conflict with CreateHelp
  41. // constructor in CBuilder
  42. constructor CreateError(const AErrCode: Integer;
  43. const AReplyMessage: string); reintroduce; virtual;
  44. property ReplyErrorCode: Integer read FReplyErrorCode;
  45. end;
  46. EInvalidSyslogMessage = class(EIdException);
  47. EIdSSLProtocolReplyError = class(EIdProtocolReplyError);
  48. EIdConnectTimeout = class(EIdException);
  49. EIdConnectException = class(EIdException);
  50. EIdSocksError = class(EIdException);
  51. EIdSocksRequestFailed = class(EIdSocksError);
  52. EIdSocksRequestServerFailed = class(EIdSocksError);
  53. EIdSocksRequestIdentFailed = class(EIdSocksError);
  54. EIdSocksUnknownError = class(EIdSocksError);
  55. EIdSocksServerRespondError = class(EIdSocksError);
  56. EIdSocksAuthMethodError = class(EIdSocksError);
  57. EIdSocksAuthError = class(EIdSocksError);
  58. EIdSocksServerGeneralError = class(EIdSocksError);
  59. EIdSocksServerPermissionError = class (EIdSocksError);
  60. EIdSocksServerNetUnreachableError = class (EIdSocksError);
  61. EIdSocksServerHostUnreachableError = class (EIdSocksError);
  62. EIdSocksServerConnectionRefusedError = class (EIdSocksError);
  63. EIdSocksServerTTLExpiredError = class (EIdSocksError);
  64. EIdSocksServerCommandError = class (EIdSocksError);
  65. EIdSocksServerAddressError = class (EIdSocksError);
  66. //IdIMAP4 Exception
  67. EIdConnectionStateError = class(EIdException);
  68. // THE EDnsResolverError is used so the resolver can repond to only resolver execeptions.
  69. EIdDnsResolverError = Class(EIdException);
  70. {Socket exceptions}
  71. EIdInvalidSocket = class(EIdException);
  72. EIdSocketError = class(EIdException)
  73. private
  74. FLastError: Integer;
  75. public
  76. // Params must be in this order to avoid conflict with CreateHelp
  77. // constructor in CBuilder
  78. constructor CreateError(const AErr: Integer; const AMsg: string); virtual;
  79. //
  80. property LastError: Integer read FLastError;
  81. end;
  82. {TIdTrivial FTP Exception }
  83. EIdTFTPException = class(EIdException);
  84. EIdTFTPFileNotFound = class(EIdTFTPException);
  85. EIdTFTPAccessViolation = class(EIdTFTPException);
  86. EIdTFTPAllocationExceeded = class(EIdTFTPException);
  87. EIdTFTPIllegalOperation = class(EIdTFTPException);
  88. EIdTFTPUnknownTransferID = class(EIdTFTPException);
  89. EIdTFTPFileAlreadyExists = class(EIdTFTPException);
  90. EIdTFTPNoSuchUser = class(EIdTFTPException);
  91. EIdTFTPOptionNegotiationFailed = class(EIdTFTPException); // RFC 1782
  92. {Icmp exceptions}
  93. EIdIcmpException = class(EIdException);
  94. EIdSetSizeExceeded = class(EIdException);
  95. implementation
  96. { EIdProtocolReplyError }
  97. constructor EIdProtocolReplyError.CreateError(const AErrCode: Integer;
  98. const AReplyMessage: string);
  99. begin
  100. inherited Create(AReplyMessage);
  101. FReplyErrorCode := AErrCode;
  102. end;
  103. constructor EIdSocketError.CreateError(const AErr: Integer; const AMsg: string);
  104. begin
  105. inherited Create(AMsg);
  106. FLastError := AErr;
  107. end;
  108. end.