Generalising JSCompiledSourceError to JSLoadSourceError

Reviewed By: javache

Differential Revision: D4312888

fbshipit-source-id: de38066247f52eeb64efa48807882b96e3737d0e
This commit is contained in:
Ashok Menon 2016-12-12 08:38:30 -08:00 committed by Facebook Github Bot
parent 165676fa5d
commit fb5678e33a
1 changed files with 5 additions and 5 deletions

View File

@ -373,19 +373,19 @@ void JSCExecutor::loadApplicationScript(
{
String jsSourceURL(m_context, sourceURL.c_str());
JSCompiledSourceError jsError;
JSLoadSourceError jsError;
auto bcSourceCode = JSCreateCompiledSourceCode(fd, jsSourceURL, &jsError);
switch (jsError) {
case JSCompiledSourceErrorOnRead:
case JSCompiledSourceErrorNotCompiled:
case JSLoadSourceErrorOnRead:
case JSLoadSourceErrorNotCompiled:
// Not bytecode, fall through.
return JSExecutor::loadApplicationScript(fd, sourceURL);
case JSCompiledSourceErrorVersionMismatch:
case JSLoadSourceErrorVersionMismatch:
throw std::runtime_error("Compiled Source Version Mismatch");
case JSCompiledSourceErrorNone:
case JSLoadSourceErrorNone:
folly::throwOnFail<std::runtime_error>(
bcSourceCode != nullptr,
"Unexpected error opening compiled bundle"