Displaying first exception message

delphi package - automated exception handling
Post Reply
david_navigator
Posts: 17
Joined: Thu Feb 22, 2018 8:45 pm

Displaying first exception message

Post by david_navigator »

Using MadExcept V5 + Delphi Sydney.

A user just sent me the following Madexcept report, asking how could we have created a situation where a database wasn't initialised correctly.
Looking at the report I can see that although the TDataset is reporting Dataset not in edit or insert mode, really the problem is shown by the inner exception The operation could not be completed in the allotted time.

We currently display exceptIntf.ExceptMessage to the user in the routine registered by

Code: Select all

RegisterExceptionHandler(MadExceptionHandlerException, stTrySyncCallAlways);
Is there anyway to additionally show the inner exception, so that I could display something like
Dataset not in edit or insert mode
caused by
The operation could not be completed in the allotted time

Code: Select all

exception class    : EDatabaseError
exception message  : cTypes: Dataset not in edit or insert mode.

Cheers

David


thread $4828:
00861795 +0c9 HireTrackNX.exe Data.DB                   DatabaseError
008786f1 +035 HireTrackNX.exe Data.DB TDataSet.UpdateRecord
008796de +006 HireTrackNX.exe Data.DB                   TDataSet.Post
0093e041 +021 HireTrackNX.exe nxdb           10942   +4 TnxDataset.Post
0094310a +00a HireTrackNX.exe nxdb           12995   +1 TnxIndexDataSet.Post
03718d89 +0c5 HireTrackNX.exe nxStockTypesU   1203   +9 TnxStockTypesForm.ChangeCategories
03718e33 +16f HireTrackNX.exe nxStockTypesU   1212  +18 TnxStockTypesForm.ChangeCategories
0371f38b +063 HireTrackNX.exe nxStockTypesU   2954   +5 TnxStockTypesForm.TypeCategoryEditPropertiesEditValueChanged
0095e434 +014 HireTrackNX.exe dxCore          1943   +2 dxCallNotify
00cbb9bd +035 HireTrackNX.exe cxEdit         10205   +3 TcxCustomEdit.DoOnEditValueChanged
00caad56 +072 HireTrackNX.exe cxEdit          2533  +10 TcxEditChangeEventsCatcher.InvokeEditChangedEvents
00caacd9 +055 HireTrackNX.exe cxEdit          2518  +15 TcxEditChangeEventsCatcher.Lock
00cbc6b2 +01e HireTrackNX.exe cxEdit         10541   +1 TcxCustomEdit.LockChangeEvents
00cfef83 +17f HireTrackNX.exe cxDropDownEdit  2694  +26 TcxCustomDropDownEdit.CloseUp
00cfe2a8 +0bc HireTrackNX.exe cxDropDownEdit  2407  +15 TcxCustomDropDownEdit.DoEditKeyDown
00cb9ac9 +0a1 HireTrackNX.exe cxEdit          9373  +14 TcxCustomEdit.KeyDown
00cefe9a +026 HireTrackNX.exe cxMaskEdit      2831   +2 TcxCustomMaskEdit.KeyDown
00cccb34 +03c HireTrackNX.exe cxTextEdit      2291   +3 TcxCustomInnerTextEdit.KeyDown
005c1f66 +092 HireTrackNX.exe Vcl.Controls TWinControl.DoKeyDown
005c1f92 +00a HireTrackNX.exe Vcl.Controls TWinControl.WMKeyDown
00ccdb40 +100 HireTrackNX.exe cxTextEdit      2700  +13 TcxCustomInnerTextEdit.WMKeyDown
005bb2a6 +2be HireTrackNX.exe Vcl.Controls              TControl.WndProc
005c01bb +68f HireTrackNX.exe Vcl.Controls              TWinControl.WndProc
00ccd0cd +25d HireTrackNX.exe cxTextEdit      2423  +56 TcxCustomInnerTextEdit.WndProc
005bf710 +02c HireTrackNX.exe Vcl.Controls TWinControl.MainWndProc
005089d0 +014 HireTrackNX.exe System.Classes            StdWndProc
76b139fb +00b user32.dll                                DispatchMessageW
00703c77 +0f3 HireTrackNX.exe Vcl.Forms TApplication.ProcessMessage
00703cba +00a HireTrackNX.exe Vcl.Forms TApplication.HandleMessage
00703fed +0c9 HireTrackNX.exe Vcl.Forms                 TApplication.Run
041df4c7 +2f3 HireTrackNX.exe HireTrackNX     1130 +110 initialization
7666fa27 +017 KERNEL32.DLL                              BaseThreadInitThunk

thread $4828, inner exception level 1:
>> EnxDatabaseError, NexusDB: cTypes: The operation could not be completed in the allotted time. [$3C65/15461]
00939f8f +02b HireTrackNX.exe nxdb            9251   +2 TnxDataset.dsCheck
0093d6fa +0fe HireTrackNX.exe nxdb           10725  +24 TnxDataset.InternalPostImpl
01960e9c +178 HireTrackNX.exe nxQueryUtils     987  +11 TnxTransactionCachedDataSet.InternalPostImpl
0093d5da +00e HireTrackNX.exe nxdb           10689   +1 TnxDataset.InternalPost
00879c2d +029 HireTrackNX.exe Data.DB TDataSet.CheckOperation
00879720 +048 HireTrackNX.exe Data.DB                   TDataSet.Post
0093e041 +021 HireTrackNX.exe nxdb           10942   +4 TnxDataset.Post
0094310a +00a HireTrackNX.exe nxdb           12995   +1 TnxIndexDataSet.Post
03718d89 +0c5 HireTrackNX.exe nxStockTypesU   1203   +9 TnxStockTypesForm.ChangeCategories
0371f38b +063 HireTrackNX.exe nxStockTypesU   2954   +5 TnxStockTypesForm.TypeCategoryEditPropertiesEditValueChanged
0095e434 +014 HireTrackNX.exe dxCore          1943   +2 dxCallNotify
00cbb9bd +035 HireTrackNX.exe cxEdit         10205   +3 TcxCustomEdit.DoOnEditValueChanged
00caad56 +072 HireTrackNX.exe cxEdit          2533  +10 TcxEditChangeEventsCatcher.InvokeEditChangedEvents
00caacd9 +055 HireTrackNX.exe cxEdit          2518  +15 TcxEditChangeEventsCatcher.Lock
00cbc6b2 +01e HireTrackNX.exe cxEdit         10541   +1 TcxCustomEdit.LockChangeEvents
00cfef83 +17f HireTrackNX.exe cxDropDownEdit  2694  +26 TcxCustomDropDownEdit.CloseUp
00cfe2a8 +0bc HireTrackNX.exe cxDropDownEdit  2407  +15 TcxCustomDropDownEdit.DoEditKeyDown
00cb9ac9 +0a1 HireTrackNX.exe cxEdit          9373  +14 TcxCustomEdit.KeyDown
00cefe9a +026 HireTrackNX.exe cxMaskEdit      2831   +2 TcxCustomMaskEdit.KeyDown
00cccb34 +03c HireTrackNX.exe cxTextEdit      2291   +3 TcxCustomInnerTextEdit.KeyDown
005c1f66 +092 HireTrackNX.exe Vcl.Controls TWinControl.DoKeyDown
005c1f92 +00a HireTrackNX.exe Vcl.Controls TWinControl.WMKeyDown
00ccdb40 +100 HireTrackNX.exe cxTextEdit      2700  +13 TcxCustomInnerTextEdit.WMKeyDown
005bb2a6 +2be HireTrackNX.exe Vcl.Controls              TControl.WndProc
005c01bb +68f HireTrackNX.exe Vcl.Controls              TWinControl.WndProc
00ccd0cd +25d HireTrackNX.exe cxTextEdit      2423  +56 TcxCustomInnerTextEdit.WndProc
005bf710 +02c HireTrackNX.exe Vcl.Controls TWinControl.MainWndProc
005089d0 +014 HireTrackNX.exe System.Classes            StdWndProc
76b139fb +00b user32.dll                                DispatchMessageW
00703c77 +0f3 HireTrackNX.exe Vcl.Forms TApplication.ProcessMessage
00703cba +00a HireTrackNX.exe Vcl.Forms TApplication.HandleMessage
00703fed +0c9 HireTrackNX.exe Vcl.Forms                 TApplication.Run
041df4c7 +2f3 HireTrackNX.exe HireTrackNX     1130 +110 initialization
7666fa27 +017 KERNEL32.DLL                              BaseThreadInitThunk 
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Displaying first exception message

Post by madshi »

Unfortunately there's no easy way to access the "inner exception" information. You could wait for the completion of the bug report and then use a text parser to check the callstacks, but that seems very ugly, to be honest.

Maybe it would make sense to add a try..except block to catch the "The operation could not be completed in the allotted time" exception and handle it more nicely?
david_navigator
Posts: 17
Joined: Thu Feb 22, 2018 8:45 pm

Re: Displaying first exception message

Post by david_navigator »

Maybe it would make sense to add a try..except block to catch the "The operation could not be completed in the allotted time" exception and handle it more nicely?
and that has made me realise what the error actually is. There is an exception handler and it's in that exception handler that I'm (wrongly) running some code that causes the outer exception.

Thanks. Now to work out how to fix.
Post Reply