MCPcopy Create free account
hub / github.com/apple/foundationdb / getErrorString

Method getErrorString

fdbclient/ClusterConnectionFile.actor.cpp:126–145  ·  view source on GitHub ↗

get a human readable error message describing the error returned from the constructor

Source from the content-addressed store, hash-verified

124
125// get a human readable error message describing the error returned from the constructor
126std::string ClusterConnectionFile::getErrorString(std::pair<std::string, bool> const& resolvedClusterFile,
127 Error const& e) {
128 bool isDefault = resolvedClusterFile.second;
129 if (e.code() == error_code_connection_string_invalid) {
130 return format("Invalid cluster file `%s': %d %s", resolvedClusterFile.first.c_str(), e.code(), e.what());
131 } else if (e.code() == error_code_no_cluster_file_found) {
132 if (isDefault)
133 return format("Unable to read cluster file `./fdb.cluster' or `%s' and %s unset: %d %s",
134 platform::getDefaultClusterFilePath().c_str(),
135 CLUSTER_FILE_ENV_VAR_NAME,
136 e.code(),
137 e.what());
138 else
139 return format(
140 "Unable to read cluster file `%s': %d %s", resolvedClusterFile.first.c_str(), e.code(), e.what());
141 } else {
142 return format(
143 "Unexpected error loading cluster file `%s': %d %s", resolvedClusterFile.first.c_str(), e.code(), e.what());
144 }
145}
146
147// Writes the connection string to the cluster file
148Future<bool> ClusterConnectionFile::persist() {

Callers

nothing calls this directly

Calls 5

formatFunction · 0.50
codeMethod · 0.45
c_strMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected