Announcements
Hello,
I’m calling an API from C#, and I need to display the authentication error, or any other error from the service.
I want to send the error to the client like this
Error(“Authentication error”);
But from C#. Just want something like an info message but from C# to the client in Dynamics.
How can I achieve this? Console.WriteLine wasn’t useful for me.
Can you show us a screenshot, please?
You forgot to mention whether the exception is caught or not. Use the debugger to find the information, if you haven't tried to debug your code yet.
How do you execute your code? Through SysOperation framework, for example?
Hi Martin, thanks for replying.
I created a C# project and added the reference in my F&O project.
Now I am throwing an exception in C# like this:
throw new Exception(“Error in request.”);
.
And I want to show that specific message in F&O, I’m doing it like this:
System.Exception ex;
/////rest of the code
catch(ex)
{
throw error(ex.Message);
}
But in the infolog shows “One or more errors occurred” instead of my custom message.
How can I display the custom exception from C# in F&O?
Thanks.
Please tell us more about your architecture. You mentioned that you have something written in C#, but it's not how it's related to F&O.
If you have a C# library that you use directly in F&O through .NET Interop, unhandled exceptions propagates to F&O and are displayed to users, or they can be handled in X++.
André Arnaud de Cal...
294,095
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator