July 15, 2024, 10:04:24 PM


IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!

Exceptions handling

Started by sapero, November 08, 2006, 04:31:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Is exception handling now build in into Aurora?
If so what is the syntax, same as sapero's examples?

Quote from: Paul Turley on January 06, 2007, 08:14:22 PM
See my post in the developers forum. 

looked for more info but to no avail.

Brice Manuel

Quote from: efgee on July 16, 2007, 05:04:06 PMlooked for more info but to no avail.
You do not have access to that forum as you are not a developer.


So is it implemented or not?

Ionic Wind Support Team

Ionic Wind Support Team


I have updated it a bit for use with multiple threads.
The __try function creates a TLS slot, and in this slot stores a pointer to newly, from heap allocated bufer with EXCEPTION_POINTERS, EXCEPTION_RECORD and CONTEXT structures. Having these structures separate for each running thread, I could add two usefull functions: GetExceptionCode and GetExceptionInformation.
Both functions can be called at any moment, but the data returned will be usefull after the first exception.

GetExceptionInformation can return NULL if the active thread didn't called __try.#include "windows.inc"
#include "gp.inc"
#use "gp.lib"

sub main()
unsigned int code, address;
string *info;

if __try()
__throw("my message"); // generate exception, custom code 0xEFFFFFFE
if __catch(&code, &address, &info)
MessageBox(0, using("& (&) at &", info, hex$(code), hex$(address)),"",0);

$include "windowssdk.inc"
$include "ebgp.inc"
$use "gp.lib"

uint code, address
pointer info

if __try()
__throw("my message") ' generate exception, custom code 0xEFFFFFFE

if __catch(&code, &address, &info)
pointer pep = GetExceptionInformation()
print hex$(*pep.*<EXCEPTION_RECORD>ExceptionRecord.ExceptionCode)
print hex$(GetExceptionCode())
MessageBox 0, using("& (&) at &", info, hex$(code), hex$(address)),"",0