How can we log exceptions that are raised from services that are executed inside the script rendering?
I tried the appHost.OnServiceException, Service.OnExceptionAsync. Both are not raised with for example a NullReferenceException in the executing Service.
Executed how? using sendToGateway should already be logged:
in a Debug logger anyway.
There’s nothing special for Service exceptions during rendering then any other rendering Exception, i.e. they still all go through the same Error Handling.
But I suppose Gateway Exceptions are intrinsic enough to warrant being able to handle them specifically so I’ve just added the ability to catch Gateway Exceptions like ServiceExceptions, can replace ServiceException with GatewayException to access the equivalent functionality to override OnGatewayException or register GatewayExceptionHandlers.
This change is available from the latest v5.8.1 that’s now available on MyGet, you’ll need to clear your NuGet packages cache to download the latest version.