0
我想在web API中实现自定义异常处理。发送类对象到异常处理
我能够实现一些初始实现,但我想传递类对象到异常来显示所有属性。像
class error
{
int error_code
string error_message
string API
}
当某些错误发生它应该显示JSON像
{
"error_code": 0,
"error_message":"Either Your are not authorized or you don't have any project yet.",
"API": "save data"
}
此代码只显示消息
throw new HttpResponseException(
Request.CreateErrorResponse(HttpStatusCode.NotFound, message));
任何建议,
感谢
谢谢......它的工作原理 –