Instrument failure to set the account when creating a split.

This commit is contained in:
John Ralls 2022-10-11 14:05:23 -07:00
parent 2d3e80ea08
commit f24c2c8bdd
2 changed files with 18 additions and 1 deletions

View File

@ -187,6 +187,7 @@ public:
void* pObject, T get_ref) void* pObject, T get_ref)
const noexcept const noexcept
{ {
static QofLogModule log_module = G_LOG_DOMAIN;
g_return_if_fail (pObject != NULL); g_return_if_fail (pObject != NULL);
try try
@ -199,9 +200,19 @@ public:
if (target != nullptr) if (target != nullptr)
set_parameter (pObject, target, get_setter(obj_name), set_parameter (pObject, target, get_setter(obj_name),
m_gobj_param_name); m_gobj_param_name);
else
DEBUG("GUID %s returned null %s reference.",
val.c_str(), m_gobj_param_name);
}
else
{
if (val.empty()) DEBUG("Can't load empty guid string for column %s", m_col_name);
else DEBUG("Invalid GUID %s for column %s", val.c_str(), m_col_name);
} }
} }
catch (std::invalid_argument&) {} catch (std::invalid_argument& err) {
DEBUG("set_parameter threw %s for column %s", err.what(), m_col_name);
}
} }

View File

@ -239,6 +239,12 @@ load_single_split (GncSqlBackend* sql_be, GncSqlRow& row)
qof_backend_set_error ((QofBackend*)sql_be, ERR_BACKEND_DATA_CORRUPT); qof_backend_set_error ((QofBackend*)sql_be, ERR_BACKEND_DATA_CORRUPT);
pSplit = NULL; pSplit = NULL;
} }
if (!xaccSplitGetAccount(pSplit))
{
gchar guidstr[GUID_ENCODING_LENGTH + 1];
guid_to_string_buff (qof_instance_get_guid (pSplit), guidstr);
PERR("Split %s created with no account!", guidstr);
}
return pSplit; return pSplit;
} }
static void static void