Sirus
Sirus

Reputation: 502

catching the warning message from aif web service

I have a aif service in ax 2012. I pass information into it from .net applications. basically i'm posting to the general journal. But when there is an error, say bad information being passed in, it returns a general error usually "error validating record". But the warning message displays the actual reason why it caused an error such as the bad data.

Is there a way to catch and display the warning message. I tried exception::warning but it just goes right to the exception::error.

catch (Exception::Error)
{
    throw Global::error("need to get warning");
}

Upvotes: 5

Views: 1468

Answers (3)

ulisses
ulisses

Reputation: 1581

I hope to understok the question.

If you ant get all Warning message from Infolog, I have a little solution. You can take all Infolog created by system, look like :

InfologData             msg;
catch (Exception::Error)
{
     msg = infolog.infologData();
     infolog.import(msg); // HERE show all infolog - with INFO - Warning - Errors
     throw Global::error("Process Error");
}

It's not exactly request, but with this way can find all InfoLog displayed and warning too.

Good Work.

References : Infolog-INFO - Infolog2String

Upvotes: 1

Jonathan Bravetti
Jonathan Bravetti

Reputation: 2238

Perhaps this can help throw error(CLRInterop::getLastException().ToString());

Upvotes: 0

Alex Kwitny
Alex Kwitny

Reputation: 11544

From memory, but have you tried:

throw error(AifUtil::getClrErrorMessage());

Upvotes: 0

Related Questions