add api usage examples for cpp and python binding

This commit is contained in:
mlangkabel
2018-12-15 02:43:34 +01:00
committed by Eberhard Graether
parent 4517be935c
commit 1c07e5b4dc
379 changed files with 12162 additions and 15 deletions
+12 -2
View File
@@ -61,7 +61,7 @@ namespace sourcetrail
return j.dump(4);
}
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy)
NameHierarchy deserializeNameHierarchyFromJson(const std::string& serializedNameHierarchy, std::string* error)
{
typedef nlohmann::json json;
@@ -110,9 +110,19 @@ namespace sourcetrail
}
}
}
catch (json::exception& e)
{
if (error)
{
*error = e.what();
}
}
catch (...)
{
// do nothing
if (error)
{
*error = "Exception thrown during NameHierarchy deserialization";
}
}
return nameHierarchy;
+5
View File
@@ -59,6 +59,11 @@ namespace sourcetrail
return m_lastError;
}
void SourcetrailDBWriter::setLastError(const std::string& error) const
{
m_lastError = error;
}
void SourcetrailDBWriter::clearLastError()
{
m_lastError.clear();