【发布时间】:2019-08-12 06:05:39
【问题描述】:
我需要从 azure 函数返回服务器错误。
现在我使用InternalServerErrorResult() 实现相同的功能。它只发送错误代码,不能用这个函数发送响应/消息。
如何在 Azure 函数中使用 actionresult 实现错误代码和消息一起发送的异常处理程序
当前实现
catch (Exception ex)
{
log.LogInformation("An error occured {0}" + ex);
//json = new Response(ex.StackTrace, AppConstants.ErrorCodes.SystemException).SerializeToString();
return (ActionResult)new InternalServerErrorResult();
}
这在邮递员中返回一个空响应,错误为 500
【问题讨论】:
标签: c# exception error-handling azure-functions