Skip to content

Commit cd3206d

Browse files
jaeyun-jungmyungjoo
authored andcommitted
[ServiceDB] handle exception
Handle exception when initializing service-db instance. Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
1 parent 67a1037 commit cd3206d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

daemon/service-db.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,18 @@ svcdb_initialize (const gchar *path)
873873
{
874874
if (g_svcdb_instance) {
875875
ml_logw ("ML service DB is already opened, close old DB.");
876-
delete g_svcdb_instance;
876+
svcdb_finalize ();
877+
}
878+
879+
try {
880+
g_svcdb_instance = new MLServiceDB (path);
881+
g_svcdb_instance->connectDB ();
882+
} catch (const std::exception &e) {
883+
ml_loge ("%s", e.what ());
884+
svcdb_finalize ();
877885
}
878886

879-
g_svcdb_instance = new MLServiceDB (path);
880887
g_assert (g_svcdb_instance);
881-
g_svcdb_instance->connectDB ();
882888
}
883889

884890
/**

0 commit comments

Comments
 (0)