Пример #1
0
        protected override async Task<bool> Process(IOwinContext context)
        {
            foreach (var handler in _handlers.OrderBy(s => s.Stage))
            {
                try
                {
                    await handler.Handler(context);

                    if ((bool)context["owin.CallCancelled"])
                    {
                        DebugOutput.Log("Request aborted");
                        break;
                    }
                }
                catch (Exception ex)
                {
                    DebugOutput.Log(ex);

                    foreach (var err in _errorHandlers)
                    {
                        var handled = await err(context, ex);

                        if (!handled)
                        {
                            context.Cancel();
                        }
                    }
                }
            }

            return false;
        }