Give access to document error log in C API
avandecreme opened this issue · comments
It would be nice to have access to the error log from the C API.
My use case is that I might get some errors from some checks/conversion. I will then fix them and re-run those checks/conversion.
If I do that, calling SBMLDocument_getNumErrors(doc)
will count the errors from both checks/conversion runs whereas I only want the ones from the second run.
For most checks, I can rely on the number of errors returned by the check and compute the offset of the first relevant error.
However, the conversion returns a boolean instead of a number of errors so I cannot do that. I still found a workaround in that case, the level and version converter actually clears the log (except in case of early return) so I can set the offset to 0.
Still, I think that being able to clear the log from the C API would be nice. While there is an API to clear the log, there is no way to retrieve the log object from a document.
So my request would be to add something like:
LIBSBML_EXTERN
const SBMLErrorLog_t *
SBMLDocument_getErrorLog(SBMLDocument_t *d)
{
return (d != NULL) ? d->getErrorLog() : NULL;
}
I am not sure about SBMLErrorLog_t
since it doesn't exist at the moment. Returning XMLErrorLog_t
instead would be fine for my use case.
What do you think?