diff --git a/AsterNET.ARI/ARIClient.cs b/AsterNET.ARI/ARIClient.cs index 12a3841..60a7855 100644 --- a/AsterNET.ARI/ARIClient.cs +++ b/AsterNET.ARI/ARIClient.cs @@ -119,6 +119,7 @@ public void Dispose() #region Private and Protected Methods + private void _eventProducer_OnConnectionStateChanged(object sender, EventArgs e) { if (_eventProducer.State != ConnectionState.Open) @@ -153,10 +154,10 @@ private void _eventProducer_OnMessageReceived(object sender, MessageEventArgs e) { FireEvent(evnt.Type, evnt, this); } - catch + catch(Exception ex) { // Handle any exceptions that were thrown by the invoked event handler - Console.WriteLine("An event listener went kaboom!"); + Console.WriteLine("The event listener " + evnt.Type.ToString() + " cause an exeption: " + ex.Message ); } }); } diff --git a/AsterNET.ARI/Middleware/Default/RESTActionConsumer.cs b/AsterNET.ARI/Middleware/Default/RESTActionConsumer.cs index 1fc061d..6d6ff94 100644 --- a/AsterNET.ARI/Middleware/Default/RESTActionConsumer.cs +++ b/AsterNET.ARI/Middleware/Default/RESTActionConsumer.cs @@ -25,8 +25,8 @@ public IRestCommand GetRestCommand(HttpMethod method, string path) { var cmd = (Command) command; var result = cmd.Client.Execute(cmd.Request); - result.RunSynchronously(); - + //result.RunSynchronously(); + result.GetAwaiter().GetResult(); var rtn = new CommandResult {StatusCode = result.Result.StatusCode, Data = result.Result.Data}; return rtn; @@ -36,8 +36,8 @@ public IRestCommandResult ProcessRestCommand(IRestCommand command) { var cmd = (Command) command; var result = cmd.Client.Execute(cmd.Request); - result.RunSynchronously(); - + //result.RunSynchronously(); + result.GetAwaiter().GetResult(); var rtn = new CommandResult {StatusCode = result.Result.StatusCode, RawData = result.Result.RawBytes}; return rtn;