alternator: correct error when trying to CreateTable an existing table

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
Nadav Har'El
2019-05-07 00:48:17 +03:00
parent 5a751ddcff
commit 53a9567804

View File

@@ -275,6 +275,10 @@ future<json::json_return_type> executor::create_table(sstring content) {
supplement_table_info(table_info, *schema);
status[TABLE_DESCRIPTION] = std::move(table_info);
return make_ready_future<json::json_return_type>(make_jsonable(std::move(status)));
}).handle_exception_type([table_name = std::move(table_name)] (exceptions::already_exists_exception&) {
return make_exception_future<json::json_return_type>(
api_error(reply::status_type::bad_request, "ResourceInUseException",
format("Table {} already exists", table_name)));
});
}