summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-05-26 23:20:45 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-05-26 23:20:45 +0100
commit7dfb580da3b6fd01b859c5bf0dc13a63eecfee59 (patch)
tree304d5114cd03577c4039222f7007711b7be4d253
parentAdd support in the lexer for accessing the current script's folder (diff)
downloadproject2-1.1.3.tar.bz2
project2-1.1.3.tar.xz
project2-1.1.3.zip
Throw on failure to open mock scriptproject2-1.1.3
-rw-r--r--project2/sql/mockDatabase.cpp3
1 files changed, 3 insertions, 0 deletions
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<FlexLexer>(new sqlFlexLexer(s.parent_path(), f, conn));
while(lexer->yylex() != 0) ;
f.close();