| 267 | } |
| 268 | |
| 269 | string parse_default(connection_options& opts) { |
| 270 | std::string name; |
| 271 | std::ifstream f; |
| 272 | bool good = config_file(f, name); |
| 273 | if (!good) { |
| 274 | throw err("no default configuration, last tried: " + name); |
| 275 | } |
| 276 | try { |
| 277 | Value root; |
| 278 | f >> root; |
| 279 | f.close(); |
| 280 | return parse(root, opts); |
| 281 | } catch (const std::ifstream::failure& e) { |
| 282 | throw err(msg() << "io error parsing '" << name << "': " << e.what()); |
| 283 | } catch (const std::exception& e) { |
| 284 | throw err(msg() << "error parsing '" << name << "': " << e.what()); |
| 285 | } catch (...) { |
| 286 | throw err(msg() << "error parsing '" << name << "'"); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | }} // namespace proton::connect_config |