Go to QuArK Web Site
QkExceptions.pas
Updated 26 Sep 2010
Upper levels:
QuArK Information Base
4. The Source Code
4.5. File-by-file descriptions

 4.5.6. QkExceptions.pas

 [ Prev - Up - Next ] 

This file contains several functions useful for exception handling.


 Index


 GetExceptionMessage

DanielPharos - 06 Sep 2008   [ Top ] 
function GetExceptionMessage(E: Exception) : String;

This function takes a generated exception, and strips the additional information from it and adds a point to the end ( . ).

The additional information is everything after a double slash ( // ), and is used by the exception handler for the MORE panel.

This function should be used instead of  E.message  whenever possible.


 LogAndWarn

DanielPharos - 23 Sep 2008   [ Top ] 
procedure LogAndWarn(const WarnMessage : String);

Logs the error message given by  ErrMessage  to the log with LOG_WARNING priority, and then pops up a dialogbox with  ErrMessage  as the message.

Note: This never raises any errors (by default...), so the code WILL return!


 LogAndRaiseError

DanielPharos - 08 Oct 2008   [ Top ] 
procedure LogAndRaiseError(const ErrMessage : String);

Logs the error message given by  ErrMessage  to the log with LOG_CRITICAL priority, and then raises a Delphi exception with  ErrMessage  as the message.

Note: Since this raises an error, the code will NOT return!


 EError

DanielPharos - 06 Sep 2008   [ Top ] 
function EError(Res: Integer) : Exception;

This function takes the number of a string from the dictionary, and creates an exception with the resulting text as the message.


 EErrorFmt

DanielPharos - 06 Sep 2008   [ Top ] 
function EErrorFmt(Res: Integer; Fmt: array of const) : Exception;

This function takes the number of a string from the dictionary, formats that string using the array of variables and values from the second parameter, and creates an exception with the resulting text as the message.


 InternalE

DanielPharos - 23 Sep 2008   [ Top ] 
function InternalE(const Hint: String) : Exception;

This function takes the hint and constructs a 'this program is buggy' message. Use this if the error can only happen if the program somehow managed to do something that *should* be impossible.


 GlobalWarning

DanielPharos - 12 Dec 2008   [ Top ] 
procedure GlobalWarning(const Texte: String);

Adds  Texte  to the list of global warnings.

Use this for instance during loading of a file, so all warnings can be displayed at once when loading has been completed.


 GlobalDisplayWarnings

DanielPharos - 12 Dec 2008   [ Top ] 
procedure GlobalDisplayWarnings;

Displays and clears all global warnings.

This is called from AppIdle, so there (normally) is no need to call it yourself.


 GetSystemErrorMessage

DanielPharos - 08 Sep 2008   [ Top ] 
function GetSystemErrorMessage(ErrNr: DWORD) : String;

Retrieves the text associated with a Windows error number. This can be used in conjunction with  GetLastError  directly after a Windows exception has occured.


 LogWindowsError

DanielPharos - 02 Apr 2010   [ Top ] 
procedure LogWindowsError(ErrNr: DWORD; const Call: String);

Use this if a Windows API fails. This procedure logs the error message given by  GetSystemErrorMessage(ErrNr)  to the log with LOG_WARNING priority, and blaims the  Call  function call for producing it.

Note: This never raises any errors (by default...), so the code WILL return!



Copyright (c) 2009, GNU General Public License by The QuArK (Quake Army Knife) Community - http://quark.sourceforge.net/

 [ Prev - Top - Next ]