From c3db68298ee72e50a00ec8ddee4806062adfa3ad Mon Sep 17 00:00:00 2001 From: youben11 Date: Wed, 25 Aug 2021 16:05:42 +0100 Subject: [PATCH] fix: checking wrong state of the error --- compiler/python/CompilerAPIModule.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/python/CompilerAPIModule.cpp b/compiler/python/CompilerAPIModule.cpp index f9a0339c4..b64e04040 100644 --- a/compiler/python/CompilerAPIModule.cpp +++ b/compiler/python/CompilerAPIModule.cpp @@ -46,7 +46,7 @@ void zamalang::python::populateCompilerAPISubmodule(pybind11::module &m) { .def("run", [](CompilerEngine &engine, std::vector args) { auto result = engine.run(args); - if (!result) { + if (!result) { // not an error llvm::errs() << "Execution failed: " << result.takeError() << "\n"; throw std::runtime_error( @@ -56,9 +56,9 @@ void zamalang::python::populateCompilerAPISubmodule(pybind11::module &m) { }) .def("compile_fhe", [](CompilerEngine &engine, std::string mlir_input) { - auto result = engine.compile(mlir_input); - if (!result) { - llvm::errs() << "Compilation failed: " << result << "\n"; + auto error = engine.compile(mlir_input); + if (error) { + llvm::errs() << "Compilation failed: " << error << "\n"; throw std::runtime_error( "failed compiling, see previous logs for more info"); }