Esempio n. 1
0
 public static async Task CallAndHandleError(Func <Task> action, IOwinRequest request, IOwinExceptionHandler exceptionHandler)
 {
     try
     {
         await action();
     }
     catch (Exception t)
     {
         exceptionHandler.ReportExceptionAsync(request, t);
         throw;
     }
 }
Esempio n. 2
0
        public static async Task CallAndHandleError <T>(Func <Task> action, BaseValidatingContext <T> context, IOwinExceptionHandler exceptionHandler)
        {
            Exception exception = null;

            try
            {
                await action();

                if (context.HasError)
                {
                    Trace.TraceWarning(
                        "Non-exceptional error during authorization. Error: '{0}', ErrorDescription: '{1}', ErrorUri: '{2}'",
                        context.Error,
                        context.ErrorDescription,
                        context.ErrorUri);
                }
            }
            catch (Exception t)
            {
                exception = t;
            }

            if (exception != null)
            {
                await exceptionHandler.ReportExceptionAndCreateResponseAsync(context, exception);
            }
        }