mirror of
https://github.com/status-im/react-native.git
synced 2025-03-03 10:50:35 +00:00
Improve watcher timeout error message (fixes #5005)
Summary: Closes https://github.com/facebook/react-native/pull/5022 Reviewed By: svcscm Differential Revision: D2793185 Pulled By: milend fb-gh-sync-id: ec49d27d6e405924269a48f32cce401b1ce380f6
This commit is contained in:
parent
5bc45f1881
commit
494d607e28
@ -96,11 +96,7 @@ function createWatcher(rootConfig) {
|
|||||||
|
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
const rejectTimeout = setTimeout(function() {
|
const rejectTimeout = setTimeout(function() {
|
||||||
reject(new Error([
|
reject(new Error(timeoutMessage(Watcher)));
|
||||||
'Watcher took too long to load',
|
|
||||||
'Try running `watchman version` from your terminal',
|
|
||||||
'https://facebook.github.io/watchman/docs/troubleshooting.html',
|
|
||||||
].join('\n')));
|
|
||||||
}, MAX_WAIT_TIME);
|
}, MAX_WAIT_TIME);
|
||||||
|
|
||||||
watcher.once('ready', function() {
|
watcher.once('ready', function() {
|
||||||
@ -111,4 +107,17 @@ function createWatcher(rootConfig) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timeoutMessage(Watcher) {
|
||||||
|
const lines = [
|
||||||
|
'Watcher took too long to load (' + Watcher.name + ')',
|
||||||
|
];
|
||||||
|
if (Watcher === sane.WatchmanWatcher) {
|
||||||
|
lines.push(
|
||||||
|
'Try running `watchman version` from your terminal',
|
||||||
|
'https://facebook.github.io/watchman/docs/troubleshooting.html',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = FileWatcher;
|
module.exports = FileWatcher;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user