Try using

 

Throw exception::error instead of throw error(“…”).

 

 

 


From: Raul Llorente Peña/OPENSOLUTIONS [mailto:[EMAIL PROTECTED]
Sent: Thursday, 14 April 2005 8:25 PM
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: [Axapta-Knowledge-Village] Why sentence try/catch is invisible for COM sessions in 2.5?

 

In 2.5, sentences blocks try/catch aren't managed by Axapta when session is a COM one.

 

Let's see this example code (doesn't matter wherever you put it to be executed);

 

TableErrors tableErrors; //A new table created, with only a string field called error.

try

{

    throw error('Error!!');

}

catch (Exception::error)

{

    info('The error has been catched');

    tableerrors.error = 'one';

    tableErrors.insert();

}

 

If this code is executed in an 'human' session, the user will see "Error!! The error has been catched", and then, when examining the table TableErrors, user will see that a new record has beeb created, with value 'one'.

 

But, when code is executed via COM (a COM session), the error is thrown but not managed, this is, no record in tableErrors will appear at all.

 

This is, it appears as if try/catch sentences were invisible to COM sessions. Why? Is there any workaround for this issue?

 

This is normal in 3.0, too?

Raúl Llorente Peña

Análisis, Desarrollo e Implementación en
Microsoft Bussiness Solutions-Axapta
OPEN SOLUTIONS



Sharing the knowledge on Axapta.




Sharing the knowledge on Axapta.



Yahoo! Groups Links

Reply via email to