예제 #1
0
        private void HandleException(Exception excp)
        {
            // ignore secondary exceptions
            if (_state == AsyncClassState.Faulted)
            {
                Logger.LogDebug("HandleException: Ignoring due to Faulted state: {0}", excp);
                return;
            }

            // notify asynchronous delegates
            if (AsyncErrorHandlers != null)
            {
                _userDispatcher.DispatchCall(new AsyncErrorParams(excp, _context), AsyncErrorCallback);
            }

            // handle the exception
            try
            {
                _state = AsyncClassState.Faulted;
                OnAsyncException(excp);
                ErrorHandlers?.Invoke(excp, _context);
            }
            catch
            {
                // we tried our best - ignore
                Logger.Log(excp);
            }
        }
예제 #2
0
 public void AsyncStart()
 {
     _mainDispatcher.DispatchCall <object>(null, StartCallback);
 }