5

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");
}
Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
Sirus
  • 382
  • 1
  • 8
  • 35

3 Answers3

1

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

ulisses
  • 1,549
  • 3
  • 37
  • 85
  • I would like to get it from AIF exception lists. under services and app integration framework – Sirus Mar 13 '17 at 19:28
0

From memory, but have you tried:

throw error(AifUtil::getClrErrorMessage());

Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71
  • Where in code are you trying to catch the error? The errors are throw to the infolog, so you actually have to cut them from there many times and/or I think the AIF error log may store them. – Alex Kwitny Mar 07 '17 at 01:49
  • there is an aif error log that has them.. i want to grab it from there.. the last error and warning message. i won't be reading or seeing any info log stuff – Sirus Mar 13 '17 at 20:04
  • Hi @AlexKwitny i'm using this code but this return empty value, why could it be? – Mumble Jun 11 '21 at 10:23
  • @Mumble that code is for catching `CLR` errors. See https://learn.microsoft.com/en-us/dynamicsax-2012/developer/how-to-catch-exceptions-thrown-from-clr-objects – Alex Kwitny Jun 11 '21 at 17:41
0

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

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29