get a human readable error message describing the error returned from the constructor
| 124 | |
| 125 | // get a human readable error message describing the error returned from the constructor |
| 126 | std::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 |
| 148 | Future<bool> ClusterConnectionFile::persist() { |
nothing calls this directly
no test coverage detected