diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-11-15 13:19:11 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-15 13:19:11 -0500 |
| commit | 520bb404f5d5fb9d7fc14ce9b5268a186aaceeaf (patch) | |
| tree | 492350e3501fc6f4fc304d4442e9498357bc549c /lib/yang.c | |
| parent | 4cce1e4d6bc2135b0a0a997be0dd8f2a95d5db38 (diff) | |
| parent | 51a2a4b3f471eba2f4416865ed19a986a6aca9f3 (diff) | |
Merge pull request #14800 from idryzhov/nb-validate-errors
Print all errors when validating NB configuration
Diffstat (limited to 'lib/yang.c')
| -rw-r--r-- | lib/yang.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/yang.c b/lib/yang.c index 7046091baa..131d89cdfa 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -676,7 +676,6 @@ static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path) const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf, size_t buf_len) { struct ly_err_item *ei; - const char *path; ei = ly_err_first(ly_ctx); if (!ei) @@ -684,18 +683,16 @@ const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf, size_t buf_len) strlcpy(buf, "YANG error(s):\n", buf_len); for (; ei; ei = ei->next) { - strlcat(buf, " ", buf_len); + if (ei->path) { + strlcat(buf, " Path: ", buf_len); + strlcat(buf, ei->path, buf_len); + strlcat(buf, "\n", buf_len); + } + strlcat(buf, " Error: ", buf_len); strlcat(buf, ei->msg, buf_len); strlcat(buf, "\n", buf_len); } - path = ly_errpath(ly_ctx); - if (path) { - strlcat(buf, " YANG path: ", buf_len); - strlcat(buf, path, buf_len); - strlcat(buf, "\n", buf_len); - } - ly_err_clean(ly_ctx, NULL); return buf; |
