Skip to content

Commit

Permalink
Make configuration validation function return validation error message
Browse files Browse the repository at this point in the history
  • Loading branch information
danghai committed Mar 21, 2018
1 parent 982f906 commit 25d32fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/tlog/play_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ tlog_play_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_play_conf_validate(NULL,
conf,
TLOG_CONF_ORIGIN_ARGS) == TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down
5 changes: 5 additions & 0 deletions lib/tlog/rec_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ tlog_rec_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_rec_conf_validate(NULL,
conf,
TLOG_CONF_ORIGIN_ARGS) == TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down
6 changes: 6 additions & 0 deletions lib/tlog/rec_session_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_rec_session_conf_validate(NULL,
conf,
TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down

0 comments on commit 25d32fc

Please sign in to comment.