Skip to content

Commit 56318fe

Browse files
committed
log UPDATE avoid using LY_EVALID without vecode
Refs #2215
1 parent ac43d12 commit 56318fe

File tree

7 files changed

+9
-15
lines changed

7 files changed

+9
-15
lines changed

src/log.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,6 @@ log_vprintf(const struct ly_ctx *ctx, LY_LOG_LEVEL level, LY_ERR err, LY_VECODE
594594
{
595595
char *msg = NULL;
596596
ly_bool free_strs = 1, lolog, lostore;
597-
const struct ly_err_item *e;
598597

599598
/* learn effective logger options */
600599
if (temp_ly_log_opts) {
@@ -636,11 +635,6 @@ log_vprintf(const struct ly_ctx *ctx, LY_LOG_LEVEL level, LY_ERR err, LY_VECODE
636635
/* store the error/warning in the context (if we need to store errors internally, it does not matter what are
637636
* the user log options) */
638637
if ((level < LY_LLVRB) && ctx && lostore) {
639-
if (((err & ~LY_EPLUGIN) == LY_EVALID) && (vecode == LYVE_SUCCESS)) {
640-
/* assume we are inheriting the error, so inherit vecode as well */
641-
e = ly_err_last(ctx);
642-
vecode = e->vecode;
643-
}
644638
free_strs = 0;
645639
if (log_store(ctx, level, err, vecode, msg, data_path, schema_path, line, apptag ? strdup(apptag) : NULL)) {
646640
goto cleanup;

src/plugins_types/ipv4_address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ lyplg_type_print_ipv4_address(const struct ly_ctx *ctx, const struct lyd_value *
303303
/* get the address in string */
304304
if (!inet_ntop(AF_INET, &val->addr, ret, INET_ADDRSTRLEN)) {
305305
free(ret);
306-
LOGERR(ctx, LY_EVALID, "Failed to get IPv4 address in string (%s).", strerror(errno));
306+
LOGERR(ctx, LY_ESYS, "Failed to get IPv4 address in string (%s).", strerror(errno));
307307
return NULL;
308308
}
309309

src/plugins_types/ipv4_address_no_zone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ lyplg_type_print_ipv4_address_no_zone(const struct ly_ctx *ctx, const struct lyd
187187
/* get the address in string */
188188
if (!inet_ntop(AF_INET, &val->addr, ret, INET_ADDRSTRLEN)) {
189189
free(ret);
190-
LOGERR(ctx, LY_EVALID, "Failed to get IPv4 address in string (%s).", strerror(errno));
190+
LOGERR(ctx, LY_ESYS, "Failed to get IPv4 address in string (%s).", strerror(errno));
191191
return NULL;
192192
}
193193

src/plugins_types/ipv6_address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ lyplg_type_print_ipv6_address(const struct ly_ctx *ctx, const struct lyd_value *
306306
/* get the address in string */
307307
if (!inet_ntop(AF_INET6, &val->addr, ret, INET6_ADDRSTRLEN)) {
308308
free(ret);
309-
LOGERR(ctx, LY_EVALID, "Failed to get IPv6 address in string (%s).", strerror(errno));
309+
LOGERR(ctx, LY_ESYS, "Failed to get IPv6 address in string (%s).", strerror(errno));
310310
return NULL;
311311
}
312312

src/plugins_types/ipv6_address_no_zone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ lyplg_type_print_ipv6_address_no_zone(const struct ly_ctx *ctx, const struct lyd
236236
/* get the address in string */
237237
if (!inet_ntop(AF_INET6, &val->addr, ret, INET6_ADDRSTRLEN)) {
238238
free(ret);
239-
LOGERR(ctx, LY_EVALID, "Failed to get IPv6 address in string (%s).", strerror(errno));
239+
LOGERR(ctx, LY_ESYS, "Failed to get IPv6 address in string (%s).", strerror(errno));
240240
return NULL;
241241
}
242242

src/tree_schema.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,7 @@ lys_parse_in(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format,
19521952
const struct ly_err_item *e = ly_err_last(ctx);
19531953

19541954
if (e && (!e->schema_path || e->line)) {
1955-
LOGERR(ctx, ret, "Parsing module \"%s\" failed.", mod->name);
1955+
LOGERR(ctx, LY_EOTHER, "Parsing module \"%s\" failed.", mod->name);
19561956
}
19571957
}
19581958
}

src/xpath.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4075,9 +4075,9 @@ xpath_deref(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp_set
40754075
r = lyplg_type_resolve_leafref((struct lysc_type_leafref *)sleaf->type, &leaf->node, &leaf->value, set->tree,
40764076
&targets, &errmsg);
40774077
if (r) {
4078-
LOGERR(set->ctx, LY_EVALID, "%s", errmsg);
4078+
LOGERR(set->ctx, LY_EINVAL, "%s", errmsg);
40794079
free(errmsg);
4080-
ret = LY_EVALID;
4080+
ret = LY_EINVAL;
40814081
goto cleanup;
40824082
}
40834083

@@ -4088,9 +4088,9 @@ xpath_deref(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp_set
40884088
} else {
40894089
assert(sleaf->type->basetype == LY_TYPE_INST);
40904090
if (ly_path_eval(leaf->value.target, set->tree, NULL, &node)) {
4091-
LOGERR(set->ctx, LY_EVALID, "Invalid instance-identifier \"%s\" value - required instance not found.",
4091+
LOGERR(set->ctx, LY_EINVAL, "Invalid instance-identifier \"%s\" value - required instance not found.",
40924092
lyd_get_value(&leaf->node));
4093-
ret = LY_EVALID;
4093+
ret = LY_EINVAL;
40944094
goto cleanup;
40954095
}
40964096

0 commit comments

Comments
 (0)