Notifications
Announcements
No record found.
Hi all, help me (ax2012)
I post product receipt by code but not catch when error
try
{
purchFormLetter.run();
//error not catch ?
}
} catch(exception::Error) { ttsabort; result = false; error("Catch an error exception."); }
Please use Insert > Insert Code (in the rich-formatting view) to paste source code. It preserves indentation, making code easier to read. Like this:
try { purchFormLetter.run(); //error not catch ? } } catch(Exception::Error) { ttsabort; result = false; error("Catch an error exception."); }
Then please explain your problem.
I see you have an extra } there (at line 5 or 6). Don't use ttsabort - throwing an exception aborts transactions, therefore this isn't needed.
Note that if you catch statement is inside a transaction, it'll be never called. The system aborts transactions and continues execution after the top-level transaction, therefore you must place your try/catch there.
Hi Martin Dráb
Unfortunately your screenshot doesn't show the critical piece of information - whether your catch statement is inside a database transaction or not. There may be a transaction somewhere in the code calling generateProductReceipt().
One way how to find it out is putting a breakpoint at the beginning of generateProductReceipt(), running the code with debugging and observing TtsLevel in the Autos window (Debug > Windows > Autos). If it's higher than zero, you're inside a transaction and you can't catch errors.
thank you, good iead, I try
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 584 Most Valuable Professional
André Arnaud de Cal... 499 Super User 2025 Season 2
Sohaib Cheema 254 User Group Leader