Permalink
Browse files

Throw when failing to load script

Reviewed By: AaaChiuuu

Differential Revision: D4929104

fbshipit-source-id: 115a44097b26bc11d20059c1667b9cf36fc47be9
  • Loading branch information...
javache authored and facebook-github-bot committed Apr 24, 2017
1 parent 43fd94d commit f09fdcbd2bc3ef5a0c7a0e509a0434433aa6e92e
Showing with 6 additions and 4 deletions.
  1. +6 −4 ReactAndroid/src/main/jni/xreact/jni/JSLoader.cpp
@@ -2,6 +2,7 @@
#include "JSLoader.h"
#include <folly/Conv.h>
#include <folly/Memory.h>
#include <android/asset_manager_jni.h>
#include <fb/fbjni.h>
@@ -77,8 +78,9 @@ std::unique_ptr<const JSBigString> loadScriptFromAssets(
}
}
}
FBLOGE("Unable to load script from assets: %s", assetName.c_str());
return folly::make_unique<JSBigStdString>("");
throw std::runtime_error(folly::to<std::string>("Unable to load script from assets '", assetName,
"'. Make sure your bundle is packaged correctly or you're running a packager server."));
}
std::string loadScriptFromFile(const std::string& fileName) {
@@ -98,8 +100,8 @@ std::string loadScriptFromFile(const std::string& fileName) {
return output;
}
FBLOGE("Unable to load script from file: %s", fileName.c_str());
return "";
throw std::runtime_error(folly::to<std::string>("Unable to load script from file: '", fileName,
"'. Make sure your bundle is packaged correctly or you're running a packager server."));
}
} }

0 comments on commit f09fdcb

Please sign in to comment.