mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	fix: Improve error message when starting read only mode with empty DB (#1946)
Fixes #1721
This commit is contained in:
		@@ -36,6 +36,7 @@
 | 
			
		||||
#include <boost/asio/spawn.hpp>
 | 
			
		||||
#include <boost/json/object.hpp>
 | 
			
		||||
#include <cassandra.h>
 | 
			
		||||
#include <fmt/core.h>
 | 
			
		||||
#include <xrpl/basics/Blob.h>
 | 
			
		||||
#include <xrpl/basics/base_uint.h>
 | 
			
		||||
#include <xrpl/basics/strHex.h>
 | 
			
		||||
@@ -113,8 +114,14 @@ public:
 | 
			
		||||
        try {
 | 
			
		||||
            schema_.prepareStatements(handle_);
 | 
			
		||||
        } catch (std::runtime_error const& ex) {
 | 
			
		||||
            LOG(log_.error()) << "Failed to prepare the statements: " << ex.what() << "; readOnly: " << readOnly;
 | 
			
		||||
            throw;
 | 
			
		||||
            auto const error = fmt::format(
 | 
			
		||||
                "Failed to prepare the statements: {}; readOnly: {}. ReadOnly should be turned off or another Clio "
 | 
			
		||||
                "node with write access to DB should be started first.",
 | 
			
		||||
                ex.what(),
 | 
			
		||||
                readOnly
 | 
			
		||||
            );
 | 
			
		||||
            LOG(log_.error()) << error;
 | 
			
		||||
            throw std::runtime_error(error);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        LOG(log_.info()) << "Created (revamped) CassandraBackend";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user