Skip to content

Commit 2412906

Browse files
mszabo-wikiafacebook-github-bot
authored andcommitted
Provide less cryptic error for missing systemlib sections (#9566)
Summary: If a new extension systemlib isn't wired up with the build system, its unit emitters and decls won't be embedded in the HHVM binary, causing a cryptic crash when trying to run Hack code ("Invalid varint value: too few bytes."). One then has to fire up a debugger to determine what systemlib is missing. Instead, raise a more informative error if a specific systemlib was not found in the binary. Split from #9564. Pull Request resolved: #9566 Reviewed By: ricklavoie Differential Revision: D67874442 fbshipit-source-id: 876fe61ff08fd05a311659a44c2b0a19ea878f94
1 parent b3ad3f1 commit 2412906

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hphp/runtime/vm/runtime-compiler.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "hphp/zend/zend-string.h"
4545
#include "unit-emitter.h"
4646

47+
#include <stdexcept>
4748
#include <folly/Likely.h>
4849
#include <folly/Range.h>
4950

@@ -259,6 +260,10 @@ Unit* get_systemlib(const std::string& path, const Extension* extension) {
259260

260261
auto buffer = get_embedded_section(path+".ue");
261262

263+
if (buffer.empty()) {
264+
throw std::invalid_argument("Missing systemlib unit emitter for path: " + path);
265+
}
266+
262267
UnitEmitterSerdeWrapper uew;
263268
BlobDecoder decoder(buffer.data(), buffer.size());
264269
uew.serde(decoder, extension);

0 commit comments

Comments
 (0)