System.GetLastErrorCallStack() Method
Version: Available or changed with runtime version 1.0.
Gets the call stack from where the last error occurred.
Syntax
String := System.GetLastErrorCallStack()
Note
This method can be invoked using property access syntax.
Note
This method can be invoked without specifying the data type name.
Return Value
String
Type: Text
Remarks
For some errors, such as divide by zero errors and overflow errors, GetLastErrorCallStack does not return every call in the stack. To get the complete call stack for these types of errors, use the debugger and specify that you want to break on errors. On the Debugger page, in the Call Stack FactBox, you can view all the method calls that led to the error.
Example
In this example, an error occurs in codeunit 50003. The text of the Message includes a call to the GetLastErrorCallStack method.
// Codeunit 50001, TestErrors1
// OnRun trigger
Error('Some error message')
// Codeunit 50002, TestErrors2
// OnRun trigger
ClearLastError;
if not Codeunit.Run(50001) then
Message('The call stack for the last error is:\' + GetLastErrorCallStack);
When you run codeunit 50002, the message window displays the following:
The call stack for the last error is:
TestErrors1(CodeUnit 50001).OnRun(Trigger) line 1
TestErrors2(CodeUnit 50002).OnRun(Trigger) line 2
See Also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈