1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:18:11 +00:00

LibWasm: Add some more descriptive parse errors

It's much better to tell the user "hey, the magic numbers don't check
out" than "oh there was a problem with your input" :P
Also refactors some stuff to make it possible to efficiently use the
parser error enum without it getting in the way.
This commit is contained in:
Ali Mohammad Pur 2021-04-27 16:23:36 +04:30 committed by Andreas Kling
parent aa4d8d26b9
commit 426878c884
3 changed files with 181 additions and 82 deletions

View file

@ -27,6 +27,7 @@ int main(int argc, char* argv[])
auto parse_result = Wasm::Module::parse(stream);
if (parse_result.is_error()) {
warnln("Something went wrong, either the file is invalid, or there's a bug with LibWasm!");
warnln("The parse error was {}", Wasm::parse_error_to_string(parse_result.error()));
return 2;
}