Skip to content

Commit e0047d5

Browse files
authored
handle ExtractStatements errors (#24)
1 parent ded075b commit e0047d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/http_server.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,15 @@ void HttpServer::DoHandleRun(const httplib::Request &req,
443443
});
444444
}
445445

446-
unique_ptr<SQLStatement> last_statement;
446+
vector<unique_ptr<SQLStatement>> statements;
447+
try {
448+
statements = connection->ExtractStatements(content);
449+
} catch (std::exception &ex) {
450+
ErrorData error(ex);
451+
SetResponseErrorResult(res, error.RawMessage());
452+
return;
453+
}
447454

448-
auto statements = connection->ExtractStatements(content);
449455
auto statement_count = statements.size();
450456

451457
if (statement_count == 0) {

0 commit comments

Comments
 (0)