added top level make, added specific error message for incorrect file name

This commit is contained in:
cjwood 2017-12-20 16:27:29 +11:00
parent 443fe3895b
commit 6700afebb4
3 changed files with 12 additions and 2 deletions

View File

@ -47,6 +47,10 @@ doc:
make -C doc -e BUILDDIR="_build/$$LANGUAGE" -e SOURCEDIR="./$$LANGUAGE" html; \
done
sim:
make -C external/cpp-simulator/src clean
make -C external/cpp-simulator/src
clean:
make -C doc clean
make -C doc -e BUILDDIR="_build/ja" -e SOURCEDIR="./ja" clean

View File

@ -94,7 +94,7 @@ json_t Simulator::execute() {
std::chrono::time_point<myclock_t> start = myclock_t::now(); // start timer
json_t ret;
ret["id"] = id;
if (simulator == 'clifford')
if (simulator == "clifford")
ret["backend"] = std::string("local_clifford_simulator");
else
ret["backend"] = std::string("local_qiskit_simulator");

View File

@ -391,7 +391,13 @@ json_t JSON::load(std::string name) {
// auto js = json::parse(read_stream(std::cin));
std::cin >> js;
else { // Load from file
std::ifstream ifile(name);
std::ifstream ifile;
ifile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try {
ifile.open(name);
} catch (std::system_error &e) {
throw std::runtime_error(std::string("no such file or directory"));
}
ifile >> js;
}
return js;