Exception handling (application.onexception) lazarus / 4-Ported from Delphi-Kylix ---------------------------------------------------------------------- scribly · 2009-01-27 04:49 Is there a way to capture unexpected exception with the onException handler like in delphi ? For example the following code: Code: [Select]var x: ^integer; begin   x:=nil;   x^:=12;  end; Will not go to the onException handler, but immediately terminate the application, without even logging what went wrong. Running it inside the debugger will show it was because of a external:sigsegv exception, but end users that come across it without a debugger won't see that, and since there is no error log of it because it crashes before onexception, it's hard to trace And yes, the above code is just an example, and I could put a try/except around it and it or even check if it's valid with IsValidReadPtr(in my situation, address 0 actually IS readable under certain situations...) but I'm just curious if there's a way to capture it without imeadiatly terminating. It'd save me time ---------------------------------------------------------------------- Leledumbo · 2009-01-27 06:50 Quote... Will not go to the onException handler, but immediately terminate the application, without even logging what went wrong.Are you sure? It should give at least RTE 216 (GPF). You can then take a look at documentation what RTE 216 means. Using -gl, it will also give the line number. Other easy way, add SysUtils to uses clause. It registers an exception handler which prints readable message for every exception.