public static void CatchErrors(this IAsyncContinuation continuation, Action action, Action final) { #if SILVERLIGHT && !WIN8 Deployment.Current.Dispatcher.BeginInvoke(() => { #endif try { action(); } catch (Exception ex) { if (ExceptionUtilities.IsCatchable(ex)) { continuation.Fail(ex); } } finally { if (final != null) { CatchErrors(continuation, final); } } #if SILVERLIGHT && !WIN8 }); #endif }
public static void CatchErrors(this IAsyncContinuation continuation, Action action, Action final) { try { action(); } catch (Exception ex) { if (ExceptionUtilities.IsCatchable(ex)) { continuation.Fail(ex); } } finally { if (final != null) { CatchErrors(continuation, final); } } }