psiexception.pas

来自「一个delphi的p2p控件的源代码」· PAS 代码 · 共 93 行

PAS
93
字号
unit PsiException;

//******************************************************************************
// The original software is under
// Copyright (c) 1993 - 2000, Chad Z. Hower (Kudzu)
//   and the Indy Pit Crew - http://www.nevrona.com/Indy/
//
// Amended : November 2000, by Michael M. Michalak MACS for use with
// MorphTek.com Inc Peer to Peer Open Source Components - http://www.morphtek.com
//
//******************************************************************************

interface

uses
  sysUtils;

type
  EPsiException = class(Exception);
  TClassPsiException = class of EPsiException;
  //
  EPsiAlreadyConnected = class(EPsiException);
  // You can add EPsiException to the list of ignored exceptions to reduce debugger "trapping"
  // of "normal" exceptions
  EPsiSilentException = class(EPsiException);

  {This exception is for protocol errors such as 404 HTTP error}
  EPsiProtocolReplyError = class(EPsiException)
  protected
    FReplyErrorCode : Integer;
  public
    // Params must be in this order to avoid conflict with CreateHelp constructor in CBuilder
    constructor CreateError(const anErrCode: Integer; const asReplyMessage: string); reintroduce;
     virtual;
    property ReplyErrorCode: Integer read FReplyErrorCode;
  end;

//------------------------------------------------------------------------------
// THE EDnsResolverError is used so the resolver can repond to only resolver
// execeptions.
//------------------------------------------------------------------------------
  EPsiDnsResolverError = Class(EPsiException);

  {Socket exceptions}
  EPsiInvalidSocket = class(EPsiException);

  EPsiSocketError = class(EPsiException)
  private
    FLastError: Integer;
  public
    // Params must be in this order to avoid conflict with CreateHelp constructor in CBuilder
    constructor CreateError(const anErr: Integer; const asMsg: string); virtual;
    //
    property LastError: Integer read FLastError;
  end;

  {TCP Connection}
  EPsiConnClosedGraceful = class(EPsiSilentException);
  EPsiResponseError = class(EPsiException);
  EPsiClosedSocket = class(EPsiException);

  {TIdTrivial FTP Exception }
  EPsiTFTPException               = class(EPsiException);
  EPsiTFTPFileNotFound            = class(EPsiTFTPException);
  EPsiTFTPAccessViolation         = class(EPsiTFTPException);
  EPsiTFTPAllocationExceeded      = class(EPsiTFTPException);
  EPsiTFTPIllegalOperation        = class(EPsiTFTPException);
  EPsiTFTPUnknownTransferID       = class(EPsiTFTPException);
  EPsiTFTPFileAlreadyExists       = class(EPsiTFTPException);
  EPsiTFTPNoSuchUser              = class(EPsiTFTPException);
  EPsiTFTPOptionNegotiationFailed = class(EPsiTFTPException);  // RFC 1782

  {Icmp exceptions}
  EPsiIcmpException = class(EPsiException);

implementation

{ EidProtocolReplyError }

constructor EPsiProtocolReplyError.CreateError(const anErrCode: Integer; const asReplyMessage: string);
begin
  inherited Create(asReplyMessage);
  FReplyErrorCode := anErrCode;
end;

constructor EPsiSocketError.CreateError(const anErr: Integer; const asMsg: string);
begin
  FLastError := anErr;
  inherited Create(asMsg);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?