-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Use case
This was created because of the discussion from: flutter/packages#5455 (comment)
webview_flutter_wkwebview handles error received from Flutter callback methods by asserting that there wasn't an error:
[self.navigationDelegateAPI didFailNavigationForDelegate:self
webView:webView
error:error
completion:^(FlutterError *error) {
NSAssert(!error, @"%@", error);
}];This would cause a crash whenever there was an error and the app was ran with asserts enabled (e.g. in debug mode). This was done because if an unexpected error was thrown on the Dart side, the NSAssert would print the error and stacktrace, but will be ignored in released mode. But as stated by @stuartmorgan
I guess the question here is: if a plugin client throws an exception in their own Dart code that implements the handler, do we want the entire application to crash?
Is it reasonable that if a client intentionally throws an exception in a callback method, that the app would crash in debug mode, but the error would be ignored in release mode. If not, we should find an alternative handling.
Proposal
Alternatively, we could switch this to an NSLog to still receive the error.