Skip to content

Commit

Permalink
fix the use of SERVER_ERROR and SERVER_FAILURE
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Nov 6, 2024
1 parent 68e9d07 commit 2a0a93b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/ogawayama/stub/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ErrorCode Connection::Impl::begin(TransactionPtr& transaction)
}
return ErrorCode::SERVER_ERROR;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}

Expand Down Expand Up @@ -159,9 +159,9 @@ ErrorCode Connection::Impl::begin(const boost::property_tree::ptree& option, Tra
transaction = std::make_unique<Transaction>(std::make_unique<Transaction::Impl>(this, transport_, response_begin.success().transaction_handle()));
return ErrorCode::OK;
}
return ErrorCode::SERVER_FAILURE;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_FAILURE;
}
}

Expand Down Expand Up @@ -232,7 +232,7 @@ ErrorCode Connection::Impl::prepare(std::string_view sql, const placeholders_typ
}
return ErrorCode::SERVER_ERROR;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/ogawayama/stub/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ErrorCode Transaction::Impl::execute_statement(std::string_view statement, std::
}
return ErrorCode::SERVER_ERROR;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}
return ErrorCode::NO_TRANSACTION;
Expand Down Expand Up @@ -218,7 +218,7 @@ ErrorCode Transaction::Impl::execute_statement(PreparedStatementPtr& prepared, c
}
return ErrorCode::SERVER_ERROR;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}
return ErrorCode::NO_TRANSACTION;
Expand Down Expand Up @@ -254,7 +254,7 @@ ErrorCode Transaction::Impl::execute_query(std::string_view query, std::shared_p
);
return ErrorCode::OK;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}
return ErrorCode::NO_TRANSACTION;
Expand Down Expand Up @@ -301,7 +301,7 @@ ErrorCode Transaction::Impl::execute_query(PreparedStatementPtr& prepared, const
);
return ErrorCode::OK;
} catch (std::runtime_error &e) {
return ErrorCode::SERVER_ERROR;
return ErrorCode::SERVER_FAILURE;
}
}
return ErrorCode::NO_TRANSACTION;
Expand Down

1 comment on commit 2a0a93b

@t-horikawa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.