my code is fairly well covered with exception handling (try..except). Some exceptions are not expected to happen and some exceptions happen fairly often, which is expected a
I think you can use the AddVectoredExceptionHandler API function.
Here is a small sample on how to use:
var
f : TFileStream;
function VectoredHandler(ExceptionInfo : PEXCEPTION_POINTERS): LongInt; stdcall;
var
s : String;
begin
S := Format('Exception code %x address %p'#10#13, [ExceptionInfo^.ExceptionRecord^.ExceptionCode,
ExceptionInfo^.ExceptionRecord^.ExceptionAddress]);
f.WriteBuffer(PChar(s)^, Length(s) * sizeof(wchar));
FlushFileBuffers(f.Handle);
OutputDebugString(PChar(Format('ExceptionCode: %x', [ExceptionInfo^.ExceptionRecord^.ExceptionCode])));
result := EXCEPTION_CONTINUE_SEARCH ;
end;
initialization
AddVectoredExceptionHandler(0, VectoredHandler);
JCL has it's own exception dialog. Just add this dialog to your project, it will handle all unexpected exceptions. Detailed info located in this JCL folder: jcl\experts\debug. There is also howto text file which step by step describes how to use it.
You can do the following:
For details, see above variable and procedure declarations.
You could add a custom handler to madExcept which would then allow you to get a full stack trace, but also carry on.