rspamd_snprintf (*target, num_str_len, "%s",
((gboolean)obj->value.iv) ? "true" : "false");
break;
+ case UCL_NULL:
+ /* String is enforced to be null */
+ *target = NULL;
+ break;
default:
g_set_error (err,
CFG_RCL_ERROR,
EINVAL,
- "cannot convert object or array to string");
+ "cannot convert %s to string in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
target.i32p = (gint32 *)(((gchar *)pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param to integer");
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.i32p = val;
target.i64p = (gint64 *)(((gchar *)pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param to integer");
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.i64p = val;
target.sp = (gsize *)(((gchar *)pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param to integer");
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.sp = val;
target.i16p = (gint16 *)(((gchar *)pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param to integer");
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.i16p = val;
g_set_error (err,
CFG_RCL_ERROR,
EINVAL,
- "cannot convert param to integer");
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.up = val;
target.ip = (gint *)(((gchar *)pd->user_struct) + pd->offset);
if (!ucl_object_toint_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param to integer");
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to integer in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
*target.ip = val;
if (!ucl_object_todouble_safe (obj, target)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param %s to double", ucl_object_key (obj));
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to double in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
if (!ucl_object_todouble_safe (obj, &val)) {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "cannot convert param %s to double", ucl_object_key (obj));
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to double in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
}
else {
g_set_error (err,
- CFG_RCL_ERROR,
- EINVAL,
- "invalid flags to parse time value in %s", ucl_object_key (obj));
+ CFG_RCL_ERROR,
+ EINVAL,
+ "cannot convert %s to time in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
+ ucl_object_key (obj));
return FALSE;
}
g_set_error (err,
CFG_RCL_ERROR,
EINVAL,
- "cannot convert an object or array to string: %s",
+ "cannot convert %s to a string list in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
ucl_object_key (obj));
ucl_object_iterate_free (iter);
g_set_error (err,
CFG_RCL_ERROR,
EINVAL,
- "cannot convert an object to boolean: %s",
+ "cannot convert %s to boolean in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
ucl_object_key (obj));
return FALSE;
}
g_set_error (err,
CFG_RCL_ERROR,
EINVAL,
- "cannot convert an object to inet address: %s",
+ "cannot convert %s to inet address in option %s",
+ ucl_object_type_to_string (ucl_object_type (obj)),
ucl_object_key (obj));
return FALSE;
}