From 7dfb580da3b6fd01b859c5bf0dc13a63eecfee59 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 26 May 2015 23:20:45 +0100 Subject: Throw on failure to open mock script --- project2/sql/mockDatabase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/project2/sql/mockDatabase.cpp b/project2/sql/mockDatabase.cpp index b357abd..a9f812d 100644 --- a/project2/sql/mockDatabase.cpp +++ b/project2/sql/mockDatabase.cpp @@ -49,6 +49,9 @@ MockDatabase::PlaySchemaScript(DB::Connection * conn, const boost::filesystem::p Logger()->messagebf(LOG_DEBUG, "%s << %s", mockName, s); std::ifstream f; f.open(s.string()); + if (!f.good()) { + throw std::runtime_error("Failed to open mock script: " + s.string()); + } auto lexer = boost::shared_ptr(new sqlFlexLexer(s.parent_path(), f, conn)); while(lexer->yylex() != 0) ; f.close(); -- cgit v1.2.3