v2.0.4-rc (#37)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	BlockStorage/repertory/pipeline/head This commit looks good
				
			# Changelog ## v2.0.4-rc ### BREAKING CHANGES * `renterd` v2.0.0+ is now required. Prior versions will fail to mount. ### Issues * \#35 [bug] Low frequency check is set to '0' instead of 1 hour by default * \#36 [bug] Max cache size bytes is set to '0' by default ### Changes from v2.0.3-rc * Added Sia API version check prior to mounting * Added back `-cv` (check version) CLI option * Continue documentation updates * Fixed setting `ApiAuth` via `set_value_by_name` * Fixed setting `HostConfig.ApiUser` via `set_value_by_name` * Fixed setting `HostConfig.Path` via `set_value_by_name` * Fixed setting `HostConfig.Protocol` via `set_value_by_name` * Improved ring buffer read-ahead * Integrated `renterd` version 2.0.0 * Prefer using local cache file when opening files * Refactored `app_config` unit tests * Refactored polling to be more accurate on scheduling tasks Reviewed-on: #37
This commit is contained in:
		| @@ -22,9 +22,6 @@ | ||||
| #include "utils/error.hpp" | ||||
|  | ||||
| namespace repertory::utils::error { | ||||
| std::atomic<const i_exception_handler *> exception_handler{ | ||||
|     &default_exception_handler}; | ||||
|  | ||||
| auto create_error_message(std::vector<std::string_view> items) -> std::string { | ||||
|   std::stringstream stream{}; | ||||
|   for (std::size_t idx = 0U; idx < items.size(); ++idx) { | ||||
| @@ -38,13 +35,30 @@ auto create_error_message(std::vector<std::string_view> items) -> std::string { | ||||
|   return stream.str(); | ||||
| } | ||||
|  | ||||
| auto create_error_message(std::string_view function_name, | ||||
|                           std::vector<std::string_view> items) -> std::string { | ||||
|   items.insert(items.begin(), function_name); | ||||
|   return create_error_message(items); | ||||
| } | ||||
|  | ||||
| auto create_exception(std::string_view function_name, | ||||
|                       std::vector<std::string_view> items) | ||||
|     -> std::runtime_error { | ||||
|   items.insert(items.begin(), function_name); | ||||
|   return std::runtime_error(create_error_message(items)); | ||||
|   return std::runtime_error(create_error_message(function_name, items)); | ||||
| } | ||||
|  | ||||
| #if defined(PROJECT_ENABLE_V2_ERRORS) | ||||
| void handle_debug(std::string_view function_name, std::string_view msg) { | ||||
|   const i_exception_handler *handler{exception_handler}; | ||||
|   if (handler != nullptr) { | ||||
|     handler->handle_debug(function_name, msg); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   default_exception_handler.handle_debug(function_name, msg); | ||||
| } | ||||
| #endif // defined(PROJECT_ENABLE_V2_ERRORS) | ||||
|  | ||||
| void handle_error(std::string_view function_name, std::string_view msg) { | ||||
|   const i_exception_handler *handler{exception_handler}; | ||||
|   if (handler != nullptr) { | ||||
| @@ -76,6 +90,38 @@ void handle_exception(std::string_view function_name, | ||||
|   default_exception_handler.handle_exception(function_name, ex); | ||||
| } | ||||
|  | ||||
| #if defined(PROJECT_ENABLE_V2_ERRORS) | ||||
| void handle_info(std::string_view function_name, std::string_view msg) { | ||||
|   const i_exception_handler *handler{exception_handler}; | ||||
|   if (handler != nullptr) { | ||||
|     handler->handle_info(function_name, msg); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   default_exception_handler.handle_info(function_name, msg); | ||||
| } | ||||
|  | ||||
| void handle_trace(std::string_view function_name, std::string_view msg) { | ||||
|   const i_exception_handler *handler{exception_handler}; | ||||
|   if (handler != nullptr) { | ||||
|     handler->handle_trace(function_name, msg); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   default_exception_handler.handle_trace(function_name, msg); | ||||
| } | ||||
|  | ||||
| void handle_warn(std::string_view function_name, std::string_view msg) { | ||||
|   const i_exception_handler *handler{exception_handler}; | ||||
|   if (handler != nullptr) { | ||||
|     handler->handle_warn(function_name, msg); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   default_exception_handler.handle_warn(function_name, msg); | ||||
| } | ||||
| #endif // defined(PROJECT_ENABLE_V2_ERRORS) | ||||
|  | ||||
| void set_exception_handler(const i_exception_handler *handler) { | ||||
|   exception_handler = handler; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user