So after some much needed updates to other areas of our software, we're updating our Twilio libraries to the latest version.
因此,在对我们软件的其他领域进行了一些急需的更新之后,我们将Twilio库更新到最新版本。
I'm looking through the API documentation, and I say this being a huge fan of how easy it was to get started originally with this API, but I'm finding the API reference a little lacking.
我正在查看API文档,我说这是最初使用此API开始的容易程度的一个巨大粉丝,但我发现API参考有点缺乏。
I wanted to better understand how the new 'CallResource' class works, but I can't find anything on it. Specifically, how it handles exceptions, if at all.
我想更好地理解新的'CallResource'类是如何工作的,但我找不到任何东西。具体来说,它如何处理异常,如果有的话。
This is how it was handled in the old code:
这是在旧代码中处理它的方式:
if (call.RestException == null)
{
Debug.WriteLine(call.Sid.ToString()
+ " " + call.StartTime.ToString()
+ " " + call.Status.ToString());
so.twillio_sid = call.Sid;
so.status = call.Status;
db.SaveChanges();
}
else
{
so.offer_status = ShiftOfferStatus.Failed;
so.status = call.RestException.Message.ToString();
callout.status = CalloutStatus.inprogressWaitingNext;
db.SaveChanges();
Debug.WriteLine(call.RestException.Message.ToString());
}
How should I go about checking if the call was initiated successfully in the new interfaces?
我应该如何检查呼叫是否在新接口中成功启动?
1 个解决方案
#1
0
So, turns out the new approach is:
所以,原来的新方法是:
try
{
//make a call
}
catch(ApiException e)
{
//handle exception state here
}
This document ended up being where the answer lies. Unfortunately the new code samples don't contain any error handling.
该文件最终成为答案所在。不幸的是,新代码示例不包含任何错误处理。
#1
0
So, turns out the new approach is:
所以,原来的新方法是:
try
{
//make a call
}
catch(ApiException e)
{
//handle exception state here
}
This document ended up being where the answer lies. Unfortunately the new code samples don't contain any error handling.
该文件最终成为答案所在。不幸的是,新代码示例不包含任何错误处理。