Improve error handling in route generation script

Reviewed By: sam-swarr

Differential Revision: D3282748

fbshipit-source-id: 17301c6639a7517d1171a67567f220471020b78d
This commit is contained in:
Pieter De Baets 2016-05-12 04:28:17 -07:00 committed by Facebook Github Bot 1
parent 9b56ff6bab
commit 1b5b5d9c5b

View File

@ -68,7 +68,9 @@ var SourceMapsUtils = {
return Promise.reject(new Error('RCTNetworking module is not available'));
}
return RCTSourceCode.getScriptText()
const scriptText = RCTSourceCode.getScriptText();
if (scriptText) {
scriptText
.then(SourceMapsUtils.extractSourceMapURL)
.then((url) => {
if (url === null) {
@ -76,6 +78,11 @@ var SourceMapsUtils = {
}
return Promise.resolve(url);
});
}
else {
// Running in mock-config mode
return Promise.reject(new Error('Couldn\'t fetch script text'));
}
},
};