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;
|
||||
fd = ::open(sourcePath.c_str(), O_RDONLY);
|
||||
if (fd == -1) {
|
||||
throw std::runtime_error(std::string("could not open js bundle file: ") + ::strerror(errno));
|
||||
}
|
||||
folly::checkUnixError(fd, "could not open js bundle file.");
|
||||
}
|
||||
|
||||
if (::fstat(fd, &fileInfo)) {
|
||||
throw std::runtime_error(std::string("fstat on js bundle failed: ") + strerror(errno));
|
||||
}
|
||||
folly::checkUnixError(::fstat(fd, &fileInfo), "fstat on js bundle failed.");
|
||||
|
||||
return folly::make_unique<const JSBigMmapString>(
|
||||
fd,
|
||||
|
|
Loading…
Reference in New Issue