📄 pfgpalmsyncerror.pas
字号:
{$WEAKPACKAGEUNIT ON}
unit pfgPalmSyncError;
{**************************************************************************}
{* pfgPalmSyncError Unit *}
{* *}
{* This unit implements handling of errors that occur in the library. *}
{* *}
{* Copyright (C) 2000 - 2002 by Paul Gilbert, All Rights Reserved *}
{**************************************************************************}
interface
uses SysUtils;
type
EPalmSyncError = class(Exception)
private
FError: Integer;
public
constructor CreateErr(const AError: Integer);
constructor CreateErrMsg(const AError: Integer; const Msg: string);
property Error: Integer read FError write FError;
end;
// Added by Mert //
EUserManagerError = class(Exception)
private
FError: Integer;
public
constructor CreateErr(const AError: Integer);
constructor CreateErrMsg(const AError: Integer; const Msg: string);
property Error: Integer read FError write FError;
end;
// End of Mert //
procedure PalmCheck(const doing: string; Error: Integer); overload;
procedure PalmCheck(Error: Integer); overload;
procedure PalmError(Error: Integer);
// Utility functions
function TranslatePalmError(const PalmError: integer): string;
function IsDirty(const Flags: integer): boolean;
function IsDeleted(const Flags: integer): boolean;
// Added by Mert //
function TranslateUserManagerErrors(const PalmError: integer): string;
procedure UserManagerCheck(Error: Integer);
// End Of Mert //
implementation
uses
pfgCondMgre,
pfgCondAPI,
pfgSyncMgr,
pfgWTypes,
pfgHslog,
pfgUserData,
pfgPalmInstall;
function IsDirty(const Flags: integer): boolean;
begin
result := (Flags and eRecAttrDirty) <> 0;
end;
function IsDeleted(const Flags: integer): boolean;
begin
result := (Flags and eRecAttrDeleted) <> 0;
end;
// PalmError
// Raises the Palm sync exception with the given Sync error
procedure PalmError(Error: Integer);
begin
raise EPalmSyncError.CreateErr(Error);
end;
procedure PalmCheck(const doing: string; Error: Integer); overload;
begin
if Error <> SYNCERR_NONE then
raise EPalmSyncError.CreateErrMsg(Error, doing);
end;
procedure PalmCheck(Error: Integer); overload;
begin
if Error <> SYNCERR_NONE then
raise EPalmSyncError.CreateErr(Error);
end;
{ EPalmSyncError }
constructor EPalmSyncError.CreateErr(const AError: Integer);
begin
inherited CreateFmt('Error %d :%s', [AError, TranslatePalmError(AError)]);
FError := AError;
end;
constructor EPalmSyncError.CreateErrMsg(const AError: Integer;
const Msg: string);
begin
inherited CreateFmt('Error %d,:%s at %s', [AError, TranslatePalmError(AError), Msg]);
FError := AError;
end;
function TranslatePalmError(const PalmError: integer): string;
begin
case PalmError of
-1: Result := 'A nonspecific error.';
CONDERR_ADD_LOCAL_RECORD: Result := 'Could not add a record to the desktop computer tables.';
CONDERR_ADD_REMOTE_RECORD: Result := 'Could not add a record on the handheld.';
CONDERR_BAD_LOCAL_BACKUP: Result := 'The backup table could not be read on the desktop computer.';
CONDERR_BAD_LOCAL_TABLES: Result := 'The tables could not be read on the desktop computer.';
CONDERR_BAD_REMOTE_TABLES: Result := 'The tables could not be read from the handheld.';
CONDERR_BAD_SYNC_TYPE: Result := 'The specified synchronization type is not valid.';
CONDERR_BUFFER_TOO_SMALL: Result := 'The buffer is too small to contain the data.';
CONDERR_CHANGE_REMOTE_RECORD: Result := 'Could not change a record on the handheld.';
CONDERR_CONDUIT_RESOURCE_FAILURE: Result := 'Could not read a resource from your conduit'' s DLL.';
CONDERR_CONVERT_FROM_REMOTE_REC: Result := 'Could not convert a handheld record to a record on the desktop computer.';
CONDERR_CONVERT_TO_LOCAL_CATS: Result := 'Could not convert a record'' s category to a category on the desktop computer.';
CONDERR_CONVERT_TO_REMOTE_CATS: Result := 'Could not convert a record'' s category to a category on the handheld.';
CONDERR_CONVERT_TO_REMOTE_REC: Result := 'Could not convert a desktop computer record to a record on the handheld.';
CONDERR_DATE_MOVED: Result := 'Dates before 1970 were moved to a valid date.';
CONDERR_INVALID_ARGSSIZE: Result := 'The argument size is not valid.';
CONDERR_INVALID_ARGSSIZE_PTR: Result := 'The output arguments size is not valid.';
CONDERR_INVALID_BUFFER_SIZE: Result := 'The buffer size is not valid for the buffer.';
CONDERR_INVALID_INARGS_PTR: Result := 'The input arguments pointer is not valid.';
CONDERR_INVALID_INARGS_STRUCT: Result := 'The input arguments structure is not valid.';
CONDERR_INVALID_OUTSIZE_PTR: Result := 'The output size pointer is not valid.';
CONDERR_INVALID_PTR: Result := 'A pointer is not valid.';
CONDERR_LOCAL_MEMORY_ALLOC_FAILED: Result := 'Could not allocate memory on the desktop computer.';
CONDERR_NO_LOCAL_CATEGORIES: Result := 'There are no categories defined on the desktop computer.';
CONDERR_NO_REMOTE_CATEGORIES: Result := 'There are no categories defined on the handheld.';
CONDERR_NONE: Result := 'The function call was successful.';
// CONDERR_NONE: Result := 'Success';
CONDERR_RAW_RECORD_ALLOCATE: Result := 'Could not allocate memory for a record.';
CONDERR_REMOTE_CHANGES_NOT_SENT: Result := 'The changes were not successfully sent to the handheld.';
CONDERR_REMOTE_RECS_NOT_PURGED: Result := 'The records on the handheld could not be successfully purged.';
CONDERR_SAVE_REMOTE_CATEGORIES: Result := 'The categories could not be saved on the handheld.';
CONDERR_SUBSCRIBE_FAILED: Result := 'The file link failed.';
CONDERR_UNSUPPORTED_CFGCONDUIT_ENUM: Result := 'The specified CfgConduit enumeration value is not supported.';
CONDERR_UNSUPPORTED_STRUCT_VERSION: Result := 'The version number of the structure is not supported on the handheld.';
// DERR_ALL_KEYS_EQUAL: Result := 'The sort was successful, but all of the keys are equal.';
// DERR_BAD_SCHEMA: Result := 'The schema object is not valid.';
// DERR_BAD_TABLE: Result := 'The table is not valid.';
// DERR_FILE_NOT_FOUND: Result := 'The specified file could not be opened.';
// DERR_FILE_NOT_SAVE: Result := 'The file was not able to be written.';
// DERR_INVALID_FILE_FORMAT: Result := 'The file could not be read.';
// DERR_INVALID_KEY_SORT: Result := 'The specified sorting key is not valid.';
// DERR_NO_CURRENT_FILENAME: Result := 'The m_TableName field does not contain a file name for the Save method to use.';
// DERR_NONE: Result := 'The function call was successful.';
// DERR_RECORD_NOT_POSITIONED: Result := 'Unable to locate record in table.';
// ERR_NONE: Result := 'The function call was successful.';
ERR_BUFFER_TOO_SMALL: Result := 'The buffer is too small to hold the requested information.';
ERR_CONDUIT_MGR: Result := 'An otherwise nonspecific Conduit Manager error occurred.';
ERR_CREATORID_ALREADY_IN_USE: Result := 'The creator ID that you specified to use as a new creator ID in the configuration entries is already in use.';
// ERR_IA_INVALID_FILE_TYPE: Result := 'The PltGetFileCount function does not recognize the extension type.';
ERR_INDEX_OUT_OF_RANGE: Result := 'The specified index value is out of range.';
ERR_INVALID_COM_PORT_TYPE: Result := 'The specified communications port type is not valid. You must use one of the Conduit Communications Port Constants.';
ERR_INVALID_CONDUIT_TYPE: Result := 'The specified conduit type is not valid. You must use one of the Conduit Information Type Constants.';
ERR_INVALID_CREATOR_ID: Result := 'The specified conduit creator ID is not valid.';
ERR_INVALID_HANDLE: Result := 'The specified structure handle is not valid.';
ERR_INVALID_POINTER: Result := 'The specified pointer is not a valid pointer.';
ERR_NO_CONDUIT: Result := 'The specified conduit does not exist.';
ERR_NO_LONGER_SUPPORTED: Result := 'The value or feature that you specified is no longer supported.';
ERR_NO_MEMORY: Result := 'Not enough memory to perform the requested operation.';
// ERR_NONE: Result := 'The function call was successful.';
(* Install Aide Error Codes *)
(* Removed slashes by Mert *)
ERR_PILOT_BUFSIZE_TOO_SMALL: Result := 'The buffer supplied as a parameter to a function is too small to contain the information that the function attempted to store.';
ERR_PILOT_COPY_FAILED: Result := 'The PltInstallFile function could not copy the file.';
ERR_PILOT_FILE_ALREADY_EXISTS: Result := 'An attempt was made to install a file that is already installed in the user'' s install directory.';
ERR_PILOT_INVALID_BUFFER: Result := 'A buffer parameter is NULL.';
ERR_PILOT_INVALID_FILE_INDEX: Result := 'The value of the index parameter passed to the PltGetFileName function is greater than the number of files.';
ERR_PILOT_INVALID_FILE_TYPE: Result := 'A file parameter is not a valid file type for use with the function.';
ERR_PILOT_INVALID_FILENAME: Result := 'The file name parameter value in a call to the PltInstallFile function is NULL.';
ERR_PILOT_INVALID_INDEX: Result := 'An index parameter exceeds the maximum value allowed for the index.';
ERR_PILOT_INVALID_PATH: Result := 'The path parameter passed to the PltSetPath function is NULL.';
ERR_PILOT_INVALID_PATH_TYPE: Result := 'The path type parameter value is not a valid path type value. For information about the path type constants, see Path Type Constants.';
ERR_PILOT_INVALID_REGISTRY: Result := 'The requested path information is not stored in the Palm configuration entries. The Palm Desktop installation program should be run to correct this problem.';
ERR_PILOT_INVALID_SOURCE_FILE: Result := 'A file passed to the install function is not a valid file.';
ERR_PILOT_INVALID_USER: Result := 'The user name parameter value is either NULL or is not a valid user name.';
ERR_PILOT_INVALID_USER_INDEX: Result := 'The value of the index parameter sent to the PltGetUser function is greater than the number of users.';
ERR_PILOT_NO_USERS: Result := 'The users data file does not contain any user information.';
ERR_PILOT_NO_USERSDAT_FILE: Result := 'There is no users data file specified in the Palm configuration entries.';
ERR_PILOT_NO_DIRECTORY : Result := 'No directory was found for the specified user.';
ERR_PILOT_NO_USER_FILE : Result := 'No users data file found.';
ERR_PILOT_NOT_FOUND: Result := 'The specified user name could not be found in the database.';
ERR_PILOT_BAD_FILENAME : Result := 'The specified file name is invalid.';
ERR_PILOT_USER_ACCESS : Result := 'The Install Aide cannot access the user data.';
//////////////// end of Mert ///////////////////////////////////
ERR_REGISTRY_ACCESS: Result := 'Unable to access the configuration entries.';
ERR_UNABLE_TO_CREATE_CONDUIT: Result := 'The conduit could not be installed.';
ERR_UNABLE_TO_DELETE: Result := 'The configuration entries for the specified conduit could not be deleted.';
ERR_UNABLE_TO_SET_CONDUIT_VALUE: Result := 'The specified conduit configuration entry value could not be set.';
ERR_VALUE_NOT_FOUND: Result := 'The specified value could not be found in the configuration entries for the conduit.';
// ERROR_HSAPI_FAILURE: Result := 'The API cannot communicate with the HotSync
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -