private static void Forget(Task task) { task.ContinueWith( t => { RnLog.Fatal(ReactConstants.RNW, t.Exception, $"Exception in fire and forget asynchronous function"); }, TaskContinuationOptions.OnlyOnFaulted); }
public void HandleException(Exception exception) { if (IsEnabled) { ShowNewNativeError(exception.Message, exception); } else { RnLog.Fatal(ReactConstants.RNW, exception, $"Exception caught in top handler"); } }
/// <summary> /// Passes the exception to the current /// <see cref="NativeModuleCallExceptionHandler"/>, if set, otherwise /// rethrows. /// </summary> /// <param name="exception"></param> public void HandleException(Exception exception) { var nativeModuleCallExceptionHandler = NativeModuleCallExceptionHandler; if (_reactInstance != null && !_reactInstance.IsDisposed && nativeModuleCallExceptionHandler != null) { nativeModuleCallExceptionHandler(exception); } else { RnLog.Fatal(ReactConstants.RNW, exception, $"Unhandled Exception in React Context"); } }
/// <summary> /// Invokes an action on a specified dispatcher and priority /// </summary> /// <param name="dispatcher">The dispatcher.</param> /// <param name="priority">The priority.</param> /// <param name="action">The action to invoke.</param> /// <param name="allowInlining">True if inlining is allowed when calling thread is on the same dispatcher as the one in the parameter.</param> public static void RunOnDispatcher(CoreDispatcher dispatcher, CoreDispatcherPriority priority, DispatchedHandler action, bool allowInlining = false) { if (allowInlining && IsOnDispatcher(dispatcher)) { action(); } else { dispatcher.RunAsync(priority, action).AsTask().ContinueWith( t => { RnLog.Fatal(ReactConstants.RNW, t.Exception, $"Exception in fire and forget asynchronous function"); }, TaskContinuationOptions.OnlyOnFaulted); } }
#pragma warning restore 0067 public void HandleException(Exception exception) { RnLog.Fatal(ReactConstants.RNW, exception, $"Exception caught in top handler"); }