I'm a bit confused as to what you mean by empty result set. There is no setting to change this default behavior.
Let's say I have 2 functions, one where I catch the error, log it and return a custom response, and the other I let the error bubble up.
public static IActionResult Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
try {
throw new Exception("caught exception");
} catch (Exception e){
log.LogError(e, "Bad request");
return new ObjectResult("There was an error") {StatusCode = 500};
}
return new OkObjectResult("OK Response");
}
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
throw new Exception("uncaught exception");
return new OkObjectResult("OK Response");
}
When I catch the exception I do have the option of returning a custom message:
As I mentioned, the function will count this as a success since it successfully returned a value to the output binding:
And it is indeed missing from the default error graph:
However, because of the log.LogError() call the stack trace and related information is retained and the request is marked as failed in App Insights.
I can then use that query to create appropriate alert rules while still returning a custom response: