From 929d4b57f10bc4200e16b71fbcf32521d8cc23c1 Mon Sep 17 00:00:00 2001 From: Gunnar Mills Date: Fri, 13 Nov 2020 09:35:30 -0600 Subject: Common Errors: Fix list formatting Pretty sure the author wanted these on separate lines so do that. Makes the list a lot easier to scan. Could have done this multiple ways but went with bullets. Fixed an escape. Tested: https://jbt.github.io/markdown-editor/ Change-Id: Ia0a0e5a2023f7eebda1ebf2d4d1d6528429cce8c Signed-off-by: Gunnar Mills --- COMMON_ERRORS.md | 63 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'COMMON_ERRORS.md') diff --git a/COMMON_ERRORS.md b/COMMON_ERRORS.md index c68c86cdfe..0157165bbe 100644 --- a/COMMON_ERRORS.md +++ b/COMMON_ERRORS.md @@ -60,23 +60,24 @@ int myBadMethod(nlohmann::json& j){ This method throws, and bad inputs will not be handled Commonly used methods that fall into this pattern: -std::variant::get -std::vector::at -std::map::at -std::set::at -std::::at -nlohmann::json::operator!= -nlohmann::json::operator+= -nlohmann::json::at -nlohmann::json::get -nlohmann::json::get\_ref -nlohmann::json::get\_to -std::filesystem::create\_directory -std::filesystem::rename -std::filesystem::file\_size -std::stoi -std::stol -std::stoll + +- std::variant::get +- std::vector::at +- std::map::at +- std::set::at +- std::\::at +- nlohmann::json::operator!= +- nlohmann::json::operator+= +- nlohmann::json::at +- nlohmann::json::get +- nlohmann::json::get\_ref +- nlohmann::json::get\_to +- std::filesystem::create\_directory +- std::filesystem::rename +- std::filesystem::file\_size +- std::stoi +- std::stol +- std::stoll #### special/strange case: @@ -91,11 +92,11 @@ throws on failure, and a method that accepts and returns an error code. This is not a complete list, but users should verify in the boost docs when calling into asio methods, and prefer the one that returns an error code instead of throwing. -boost::asio::ip::tcp::acceptor::bind(); -boost::asio::ip::tcp::acceptor::cancel(); -boost::asio::ip::tcp::acceptor::close(); -boost::asio::ip::tcp::acceptor::listen(); -boost::asio::ip::address::make\_address(); +- boost::asio::ip::tcp::acceptor::bind(); +- boost::asio::ip::tcp::acceptor::cancel(); +- boost::asio::ip::tcp::acceptor::close(); +- boost::asio::ip::tcp::acceptor::listen(); +- boost::asio::ip::address::make\_address(); ### Blocking functions @@ -103,15 +104,15 @@ bmcweb uses a single reactor for all operations. Blocking that reactor for any amount of time causes all other operations to stop. The common blocking functions that tend to be called incorrectly are: -sleep() -boost::asio::ip::tcp::socket::read() -boost::asio::ip::tcp::socket::read\_some() -boost::asio::ip::tcp::socket::write() -boost::asio::ip::tcp::socket::write\_some() -boost::asio::ip::tcp::socket::connect() -boost::asio::ip::tcp::socket::send() -boost::asio::ip::tcp::socket::wait() -boost::asio::steady\_timer::wait() +- sleep() +- boost::asio::ip::tcp::socket::read() +- boost::asio::ip::tcp::socket::read\_some() +- boost::asio::ip::tcp::socket::write() +- boost::asio::ip::tcp::socket::write\_some() +- boost::asio::ip::tcp::socket::connect() +- boost::asio::ip::tcp::socket::send() +- boost::asio::ip::tcp::socket::wait() +- boost::asio::steady\_timer::wait() Note: an exception is made for filesystem/disk IO read and write. This is mostly due to not having great abstractions for it that mate well with the async -- cgit v1.2.3