Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamics Ax 2009, Exception Handling

In my x++ code I have the following

void run() {
    try
    {
        startLengthyOperation();
        this.readFile();    
    }
    catch (Exception::Deadlock)
    {
        retry;
    }
    catch (Exception::Error)
    {
        error(strfmt("An error occured while trying to read the file %1", filename));
    }
    catch
    {
        error("An unkown error has occured");
    }

    endLengthyOperation();
}

I am hitting the final catch (prior, I was getting no message about exceptions). But I want to know what is REALLY happening and causing the exception. How can I find out what the exception is?

like image 301
CaffGeek Avatar asked Jan 14 '11 16:01

CaffGeek


1 Answers

You could add stackTrace to the info log and add an info message when you get to the last catch. That would show you exactly what the code was doing at the time it reached the catch.

like image 153
Michael Brown Avatar answered Sep 30 '22 07:09

Michael Brown