You are not logged in.
Pages: 1
Hello Arnaud,
To ignore certain exceptions I know there is alread the ExceptionIgnore property, but it's not very handy in case there are tons of exceptions to ignore.
For example in one of my programs which uses both mORMot and Indy, I definitely want SQLite3Log to intercept exceptions raised by the mORMot framework only but NOT exceptions caused by Indy.
But there are too much exceptions that's possible raised by Indy, so instead of calling ExceptionIgnore.Add() near one hundred times, I'd prefer to code some thing like
TMyChildSynLog = class(TSynLog)
...
function IsExceptionIgnorable(aException: Exception): Boolean;
...
implementation
...
function TMyChildSynLog.IsExceptionIgnorable(aException: Exception): Boolean;
begin
Result := aException.InheritesFrom(EIdException);
end;
...
Hope it makes sense.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
"Exceptions should be exceptional"... Indy didn't follow this pattern we like very much!
So you expect a callback event to check for the exception kind?
Or may a wildchar/glob TMatch on the class name suite you? E.g. to set 'EId*,EIndy*' in a parameter.
Offline
Hi ab,
I strongly strongly strongly prefer a callback event to check for the exception kind, it'll be much flexible! Thank you!
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@ab,
I added such ability, if no problem please merge pull request I made just now: https://github.com/synopse/mORMot/pull/142
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
@ab,
Did you forget the pull request? I have made the changes as you requested
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Please check https://synopse.info/fossil/info/921511a12b
I have renamed it but the very same functionality.
Thanks for the pull request!
Offline
/// callback signature used by TSynLogFamilly.OnBeforeException
// - should return true to log the exception, or false to ignore it
TSynLogOnBeforeException = function(aExceptionContext: TSynLogExceptionContext): boolean of object;
ab, please correct description: should return false to log the exception, or true to ignore it.
Offline
Thank you ab for merging it.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
/// callback signature used by TSynLogFamilly.OnBeforeException // - should return true to log the exception, or false to ignore it TSynLogOnBeforeException = function(aExceptionContext: TSynLogExceptionContext): boolean of object;
ab, please correct description: should return false to log the exception, or true to ignore it.
What's why I have originally named the event property as "HandleExceptionBeforeLogging", the keyword is "handle", because if it handle it, it should return True, and then TSynLog should ignore it
However I'm certainly OK with ab's new naming, but you are right, the comment you mentioned is wrong.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Oups... sorry for the comment problem.
Offline
@ab,
Is it possible to include the ID of the thread who's causing an exception with TSynLogExceptionContext? The thread ID can be helpful in the OnBeforeException event handler.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Pages: 1