Currently we have a lot of the following pattern in the BaseApp and in our apps.
if not CODEUNIT.Run(CODEUNIT::"Posting Codeunit", MyRecord) then begin
SaveErrorWithCommit()
Error(GetLastErrorText);
end;
Error(GetLastErrorText); isn't ideal for Telemetry. It would be better if we'd be able to rethrow the last Error with a simple statement like
System.ReThrowLastError(); -> The error should have all the info of the original error and should be send to Telemetry as expected.
The corresponding statement in .net would be throw; in a catch block.
Comments
This can be really helpful. We are really struggling with debugging D365 Sales integration using telemetry as almost all the errors are rethrown and hence not fully visible in telemetry.
Category: Development

Business Central Team (administrator)
Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team