Handle uncaught error for warnIfSlow (#56418)
This commit is contained in:
parent
6f0ed5e142
commit
c2b7342ca4
@ -633,7 +633,15 @@ Future<T> _warnIfSlow<T>({
|
|||||||
assert(future != null);
|
assert(future != null);
|
||||||
assert(timeout != null);
|
assert(timeout != null);
|
||||||
assert(message != null);
|
assert(message != null);
|
||||||
return future..timeout(timeout, onTimeout: () { _log(message); return null; });
|
future
|
||||||
|
.timeout(timeout, onTimeout: () {
|
||||||
|
_log(message);
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
// Don't duplicate errors if [future] completes with an error.
|
||||||
|
.catchError((dynamic e) => null);
|
||||||
|
|
||||||
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encapsulates connection information to an instance of a Flutter application.
|
/// Encapsulates connection information to an instance of a Flutter application.
|
||||||
|
@ -665,6 +665,16 @@ void main() {
|
|||||||
expect(error.message, 'Error in Flutter application: {message: This is a failure}');
|
expect(error.message, 'Error in Flutter application: {message: This is a failure}');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('uncaught remote error', () async {
|
||||||
|
when(mockIsolate.invokeExtension(any, any)).thenAnswer((Invocation i) {
|
||||||
|
return Future<Map<String, dynamic>>.error(
|
||||||
|
rpc.RpcException(9999, 'test error'),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(driver.waitFor(find.byTooltip('foo')), throwsDriverError);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user