?? myldbexcept.pas
字號:
unit MYLDBExcept;
interface
uses SysUtils, Classes, MYLDBConst;
type
////////////////////////////////////////////////////////////////////////////////
//
// EMYLDBException
//
////////////////////////////////////////////////////////////////////////////////
EMYLDBException = class( Exception )
public
NativeError: Integer;
constructor Create(NativeErrorCode: Integer; ErrorMsg: String); overload;
constructor Create(NativeErrorCode: Integer; ErrorMsg: String; const Args: array of const); overload;
end; // EMYLDBException
implementation
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
constructor EMYLDBException.Create(NativeErrorCode: Integer; ErrorMsg: String);
var
ErMessage: string;
begin
NativeError := NativeErrorCode;
ErMessage := ErrorMsg;
ErMessage := ErMessage + ' - Native error: '+ Format('%.5d',[NativeErrorCode]);
inherited Create(ErMessage);
end; // Create
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
constructor EMYLDBException.Create(NativeErrorCode: Integer; ErrorMsg: String; const Args: array of const);
var
ErMessage: string;
begin
NativeError := NativeErrorCode;
try
ErMessage := Format(ErrorMsg, Args);
except
ErMessage := ErrorMsg + ' Arguments are invalid!';
end;
ErMessage := ErMessage + ' - Native error: ' + Format('%5d',[NativeErrorCode]);
inherited Create(ErMessage);
end; // Create
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -