Use folly for error checking
Summary: Small refactor, making error checking clearer. Reviewed By: lexs Differential Revision: D4189090 fbshipit-source-id: f3a24eacfe6dd154d29662f510ce19dbe55f89a6
This commit is contained in:
parent
f22dfa3efb
commit
89d81b34db
|
@ -57,14 +57,10 @@ std::unique_ptr<const JSBigMmapString> JSBigMmapString::fromOptimizedBundle(
|
||||||
{
|
{
|
||||||
auto sourcePath = bundlePath + UNPACKED_JS_SOURCE_PATH_SUFFIX;
|
auto sourcePath = bundlePath + UNPACKED_JS_SOURCE_PATH_SUFFIX;
|
||||||
fd = ::open(sourcePath.c_str(), O_RDONLY);
|
fd = ::open(sourcePath.c_str(), O_RDONLY);
|
||||||
if (fd == -1) {
|
folly::checkUnixError(fd, "could not open js bundle file.");
|
||||||
throw std::runtime_error(std::string("could not open js bundle file: ") + ::strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::fstat(fd, &fileInfo)) {
|
folly::checkUnixError(::fstat(fd, &fileInfo), "fstat on js bundle failed.");
|
||||||
throw std::runtime_error(std::string("fstat on js bundle failed: ") + strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
return folly::make_unique<const JSBigMmapString>(
|
return folly::make_unique<const JSBigMmapString>(
|
||||||
fd,
|
fd,
|
||||||
|
|
Loading…
Reference in New Issue