General X++ Development
How do I catch exceptions in X++?
How do I catch exceptions in X++?
1 answer
Write an answerUse try/catch.
try
{
// Code that may fail.
}
catch (Exception::Error)
{
error('Something went wrong.');
}Catch the specific exception type when it matters.
Also keep CLR/.NET exceptions in mind. If the failure comes from .NET code, Exception::Error might not be the exception you need to handle.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer