From 274c49d89623b95f8b682b8dba5e9db9174ec808 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 1 Oct 2015 22:32:12 +0600 Subject: Some error handling in config loading. --- src/vyconfd.ml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vyconfd.ml b/src/vyconfd.ml index 4a5cd5d..29345fb 100644 --- a/src/vyconfd.ml +++ b/src/vyconfd.ml @@ -1,5 +1,15 @@ +open Lwt open Defaults -let config = Vyconf_config.load defaults.config_file +let () = Lwt_log.add_rule "*" Lwt_log.Info + +let config = + let result = Vyconf_config.load defaults.config_file in + match result with + | `Ok cfg -> cfg + | `Error err -> + Lwt_log.fatal (Printf.sprintf "Could not load the configuration file %s" err); exit 1 + + let () = print_endline "This is VyConf. Or, rather, will be." -- cgit v1.2.3