So the issue is that the API server returns a 404 when it can’t find the record. This is happening because its still sending the SMS (its not instant) and it doesn’t create the receipt/status record until this is complete.
I’m trying to find a good solution to retry the call with a sleep function. Feel free to provide any ideas you have. Its hard to find references on JScript.
Microsoft.ClearScript.ScriptEngineException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.ClearScript.Util.InvokeHelpers.InvokeMethod(IHostInvokeContext context, Object target, MethodInfo method, Object[] args)
at Microsoft.ClearScript.HostItem.MethodBindSuccess.Invoke(HostItem hostItem)
at Microsoft.ClearScript.HostItem.InvokeMethod(String name, Type[] typeArgs, Object[] args, Object[] bindArgs)
at Microsoft.ClearScript.HostItem.InvokeMethod(String name, Object[] args, Object[] bindArgs)
at Microsoft.ClearScript.HostItem.InvokeHostMember(String name, BindingFlags invokeFlags, Object[] args, Object[] bindArgs, CultureInfo culture, Boolean& isCacheable)
at Microsoft.ClearScript.HostItem.InvokeMember(String name, BindingFlags invokeFlags, Object[] args, Object[] bindArgs, CultureInfo culture, Boolean bypassTunneling, Boolean& isCacheable)
at Microsoft.ClearScript.HostItem.<>c__DisplayClass156_0.<InvokeReflectMember>b__0()
at Microsoft.ClearScript.ScriptEngine.HostInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine.HostInvoke[T](Func`1 func)
--- End of inner exception stack trace ---
at Microsoft.ClearScript.Windows.WindowsScriptItem.TryBindAndInvoke(DynamicMetaObjectBinder binder, Object[] args, Object& result)
at Microsoft.ClearScript.ScriptItem.<>c__DisplayClass7_0.<TryWrappedBindAndInvoke>b__0()
at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass57_0`1.<ScriptInvoke>b__0()
at Microsoft.ClearScript.ScriptEngine.ScriptInvokeInternal[T](Func`1 func)
at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.Windows.WindowsScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.ScriptItem.TryWrappedBindAndInvoke(DynamicMetaObjectBinder binder, Object[] wrappedArgs, Object& result)
at Microsoft.ClearScript.ScriptItem.TryWrappedInvokeOrInvokeMember(DynamicMetaObjectBinder binder, ParameterInfo[] parameters, Object[] args, Object& result)
at Microsoft.ClearScript.ScriptItem.TryInvoke(InvokeBinder binder, Object[] args, Object& result)
at CallSite.Target(Closure , CallSite , Object )
at Microsoft.ClearScript.HostFunctions.tryCatch(Object tryFunc, Object catchFunc, Object finallyFunc)