From 53a9567804d722ce2ad64012bb159f34fa762c0e Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Tue, 7 May 2019 00:48:17 +0300 Subject: [PATCH] alternator: correct error when trying to CreateTable an existing table Signed-off-by: Nadav Har'El --- alternator/executor.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/alternator/executor.cc b/alternator/executor.cc index 7488e58b5d..e4198f6c68 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -275,6 +275,10 @@ future executor::create_table(sstring content) { supplement_table_info(table_info, *schema); status[TABLE_DESCRIPTION] = std::move(table_info); return make_ready_future(make_jsonable(std::move(status))); + }).handle_exception_type([table_name = std::move(table_name)] (exceptions::already_exists_exception&) { + return make_exception_future( + api_error(reply::status_type::bad_request, "ResourceInUseException", + format("Table {} already exists", table_name))); }); }