summaryrefslogtreecommitdiff
path: root/examples/ModuleMaker
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ModuleMaker')
-rw-r--r--examples/ModuleMaker/ModuleMaker.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp
index 04c6a9f95b..4c09db4df7 100644
--- a/examples/ModuleMaker/ModuleMaker.cpp
+++ b/examples/ModuleMaker/ModuleMaker.cpp
@@ -54,7 +54,12 @@ int main() {
BB->getInstList().push_back(new ReturnInst(Add));
// Output the bytecode file to stdout
- WriteBytecodeToFile(M, std::cout);
+ try {
+ WriteBytecodeToFile(M, std::cout);
+ } catch (const std::string &Error) {
+ std::cerr << "Error writing file: " << Error << "\n";
+ return 1;
+ }
// Delete the module and all of its contents.
delete M;