How store the variable value automatically from context in AX

Hi All,

Do we have any option to store the value of all the context when system throw an error?

I am working on AI project where it need to analyse the error and propose a solution by itself. For that I need the call stack and the variable value during the execution.

If any one can help me on this, it will be great help.

Thanks in advance.