private void LogException(IChannelHandlerContext context, Exception ex, string methodName) { if (ClientChannelHandler != null) { ClientChannelHandler.ClientChannelError(new ClientChannelErrorEventArgs { //ChannelId = ClientChannelConfigurationManager.Instance.Configurations.ChannelId, //ChannelKey = ChannelKey, Context = new ClientContext(context), Message = ex.Message, Details = ex.ToString() }); } Log?.Error(className, methodName, string.Format("Message: {0}, Details: {1}", ex.Message, ex.ToString())); }
public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) { base.ExceptionCaught(context, exception); try { channel = context.Channel; if (ClientChannelHandler != null) { ClientChannelHandler.ClientChannelError(new ClientChannelErrorEventArgs { //ChannelKey = ChannelKey, //ChannelId = ClientChannelConfigurationManager.Instance.Configurations.ChannelId, Context = new ClientContext(context), Message = exception.Message, Details = exception.ToString() }); } //context.CloseAsync(); } catch (Exception ex) { LogException(context, ex, "ExceptionCaught"); } }