www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Catching AVs on Windows

reply Robert Fraser <fraserofthenight gmail.com> writes:
Hi,

Has anyone had any success trapping access violations on Windows and 
changing them into D exceptions? I created a function and passed it to 
SetUnhandledExceptionFilter, but my exception filter never triggered on 
the access violation.

Thanks,
Robert
Apr 13 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Robert Fraser" <fraserofthenight gmail.com> wrote in message 
news:fttsdl$2nec$1 digitalmars.com...
 Hi,

 Has anyone had any success trapping access violations on Windows and 
 changing them into D exceptions? I created a function and passed it to 
 SetUnhandledExceptionFilter, but my exception filter never triggered on 
 the access violation.

 Thanks,
 Robert

They already are, IIRC. They might not be converted to Exceptions, though, but I know you can catch them with catch(Object).
Apr 13 2008
parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Jarrett Billingsley wrote:
 "Robert Fraser" <fraserofthenight gmail.com> wrote in message 
 news:fttsdl$2nec$1 digitalmars.com...
 Hi,

 Has anyone had any success trapping access violations on Windows and 
 changing them into D exceptions? I created a function and passed it to 
 SetUnhandledExceptionFilter, but my exception filter never triggered on 
 the access violation.

 Thanks,
 Robert

They already are, IIRC. They might not be converted to Exceptions, though, but I know you can catch them with catch(Object).

Oh you're right! Thanks! Any way to make it throw an Exception (since I'm adding trace hooks to the Exception constructor)?
Apr 13 2008
parent Robert Fraser <fraserofthenight gmail.com> writes:
Robert Fraser wrote:
 Jarrett Billingsley wrote:
 "Robert Fraser" <fraserofthenight gmail.com> wrote in message 
 news:fttsdl$2nec$1 digitalmars.com...
 Hi,

 Has anyone had any success trapping access violations on Windows and 
 changing them into D exceptions? I created a function and passed it 
 to SetUnhandledExceptionFilter, but my exception filter never 
 triggered on the access violation.

 Thanks,
 Robert

They already are, IIRC. They might not be converted to Exceptions, though, but I know you can catch them with catch(Object).

Oh you're right! Thanks! Any way to make it throw an Exception (since I'm adding trace hooks to the Exception constructor)?

Oops, never mind, it _is_ an exception. Now to figure out why it won't trace...
Apr 13 2008