如何从 restSharp 获取 errorMessage?
How to get errorMessage from restSharp?
如果我的 api 服务器有:
,我如何让 RestClient 收到错误消息 "this is a exception !"
throw new Exception("this is a exception !")
;?
也许这会对您有所帮助:
Note that exceptions from Execute are not thrown but are available in the ErrorException property.
var response = client.Execute<T>(request);
if (response.ErrorException != null)
{
const string message = "Error retrieving response. Check inner details for more info.";
var twilioException = new ApplicationException(message, response.ErrorException);
throw twilioException;
}
注:
response.ErrorException
如果我的 api 服务器有:
,我如何让 RestClient 收到错误消息 "this is a exception !"throw new Exception("this is a exception !")
;?
也许这会对您有所帮助:
Note that exceptions from Execute are not thrown but are available in the ErrorException property.
var response = client.Execute<T>(request);
if (response.ErrorException != null)
{
const string message = "Error retrieving response. Check inner details for more info.";
var twilioException = new ApplicationException(message, response.ErrorException);
throw twilioException;
}
注:
response.ErrorException