[llvm-readobj] Improve errors on invalid binary

The previous code was discarding the error message from
createBinary() by calling errorToErrorCode().
This meant that such error were always reported unhelpfully
as "Invalid data was encountered while parsing the file".

Other tools such as llvm-objdump already produce a more
the error message in this case.

Differential Revision: https://reviews.llvm.org/D32985

llvm-svn: 302664
diff --git a/llvm/test/tools/llvm-readobj/wasm-invalid.test b/llvm/test/tools/llvm-readobj/wasm-invalid.test
new file mode 100644
index 0000000..d500d58
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/wasm-invalid.test
@@ -0,0 +1,7 @@
+# RUN: yaml2obj %s | not llvm-readobj -t - 2>&1 | FileCheck %s
+
+--- !WASM
+FileHeader:
+  Version:         0x0000000c
+
+# CHECK: Error reading file: <stdin>: Bad version number