Catch and forward iOS exceptions to Flutter
This commit is contained in:
parent
aaa253b133
commit
35a6e4810b
|
@ -84,6 +84,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
|
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
|
||||||
|
@try {
|
||||||
NSDictionary *request = (NSDictionary *)call.arguments;
|
NSDictionary *request = (NSDictionary *)call.arguments;
|
||||||
if ([@"load" isEqualToString:call.method]) {
|
if ([@"load" isEqualToString:call.method]) {
|
||||||
[self load:request[@"audioSource"] result:result];
|
[self load:request[@"audioSource"] result:result];
|
||||||
|
@ -129,6 +130,11 @@
|
||||||
} else {
|
} else {
|
||||||
result(FlutterMethodNotImplemented);
|
result(FlutterMethodNotImplemented);
|
||||||
}
|
}
|
||||||
|
} @catch (id exception) {
|
||||||
|
NSLog(@"Error in handleMethodCall");
|
||||||
|
FlutterError *flutterError = [FlutterError errorWithCode:@"error" message:@"Error in handleMethodCall" details:nil];
|
||||||
|
result(flutterError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Untested
|
// Untested
|
||||||
|
|
Loading…
Reference in New Issue