# HG changeset patch # User Sebastien Jodogne # Date 1618239898 -7200 # Node ID 67d112ef680f68660db4bcbacba1e81fcac012bf # Parent 2684544ff03ce41f4cc51507d1cfe0345abfe2ec added missing try/catch diff -r 2684544ff03c -r 67d112ef680f OrthancServer/Sources/ServerIndex.cpp --- a/OrthancServer/Sources/ServerIndex.cpp Thu Apr 08 10:46:12 2021 +0200 +++ b/OrthancServer/Sources/ServerIndex.cpp Mon Apr 12 17:04:58 2021 +0200 @@ -465,30 +465,37 @@ } } - /** - * WARNING: Don't protect the calls to "LogChange()" using - * "monitoringMutex_", as this could lead to deadlocks in - * other threads (typically, if "Store()" is being running in - * another thread, which leads to calls to "MarkAsUnstable()", - * which leads to two lockings of "monitoringMutex_"). - **/ - switch (stableResource.GetResourceType()) + try { - case ResourceType_Patient: - that->LogChange(stableId, ChangeType_StablePatient, stableResource.GetPublicId(), ResourceType_Patient); - break; - - case ResourceType_Study: - that->LogChange(stableId, ChangeType_StableStudy, stableResource.GetPublicId(), ResourceType_Study); - break; + /** + * WARNING: Don't protect the calls to "LogChange()" using + * "monitoringMutex_", as this could lead to deadlocks in + * other threads (typically, if "Store()" is being running in + * another thread, which leads to calls to "MarkAsUnstable()", + * which leads to two lockings of "monitoringMutex_"). + **/ + switch (stableResource.GetResourceType()) + { + case ResourceType_Patient: + that->LogChange(stableId, ChangeType_StablePatient, stableResource.GetPublicId(), ResourceType_Patient); + break; - case ResourceType_Series: - that->LogChange(stableId, ChangeType_StableSeries, stableResource.GetPublicId(), ResourceType_Series); - break; + case ResourceType_Study: + that->LogChange(stableId, ChangeType_StableStudy, stableResource.GetPublicId(), ResourceType_Study); + break; + + case ResourceType_Series: + that->LogChange(stableId, ChangeType_StableSeries, stableResource.GetPublicId(), ResourceType_Series); + break; - default: - throw OrthancException(ErrorCode_InternalError); + default: + throw OrthancException(ErrorCode_InternalError); + } } + catch (OrthancException& e) + { + LOG(ERROR) << "Cannot log a change about a stable resource into the database"; + } } }