comparison OrthancServer/Sources/ServerIndex.cpp @ 4614:67d112ef680f db-changes

added missing try/catch
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Apr 2021 17:04:58 +0200
parents d494b4f1103e
children f7d5372b59b3
comparison
equal deleted inserted replaced
4613:2684544ff03c 4614:67d112ef680f
463 // No more stable DICOM resource, leave the internal loop 463 // No more stable DICOM resource, leave the internal loop
464 break; 464 break;
465 } 465 }
466 } 466 }
467 467
468 /** 468 try
469 * WARNING: Don't protect the calls to "LogChange()" using
470 * "monitoringMutex_", as this could lead to deadlocks in
471 * other threads (typically, if "Store()" is being running in
472 * another thread, which leads to calls to "MarkAsUnstable()",
473 * which leads to two lockings of "monitoringMutex_").
474 **/
475 switch (stableResource.GetResourceType())
476 { 469 {
477 case ResourceType_Patient: 470 /**
478 that->LogChange(stableId, ChangeType_StablePatient, stableResource.GetPublicId(), ResourceType_Patient); 471 * WARNING: Don't protect the calls to "LogChange()" using
479 break; 472 * "monitoringMutex_", as this could lead to deadlocks in
473 * other threads (typically, if "Store()" is being running in
474 * another thread, which leads to calls to "MarkAsUnstable()",
475 * which leads to two lockings of "monitoringMutex_").
476 **/
477 switch (stableResource.GetResourceType())
478 {
479 case ResourceType_Patient:
480 that->LogChange(stableId, ChangeType_StablePatient, stableResource.GetPublicId(), ResourceType_Patient);
481 break;
480 482
481 case ResourceType_Study: 483 case ResourceType_Study:
482 that->LogChange(stableId, ChangeType_StableStudy, stableResource.GetPublicId(), ResourceType_Study); 484 that->LogChange(stableId, ChangeType_StableStudy, stableResource.GetPublicId(), ResourceType_Study);
483 break; 485 break;
484 486
485 case ResourceType_Series: 487 case ResourceType_Series:
486 that->LogChange(stableId, ChangeType_StableSeries, stableResource.GetPublicId(), ResourceType_Series); 488 that->LogChange(stableId, ChangeType_StableSeries, stableResource.GetPublicId(), ResourceType_Series);
487 break; 489 break;
488 490
489 default: 491 default:
490 throw OrthancException(ErrorCode_InternalError); 492 throw OrthancException(ErrorCode_InternalError);
493 }
491 } 494 }
495 catch (OrthancException& e)
496 {
497 LOG(ERROR) << "Cannot log a change about a stable resource into the database";
498 }
492 } 499 }
493 } 500 }
494 501
495 LOG(INFO) << "Closing the monitor thread for stable resources"; 502 LOG(INFO) << "Closing the monitor thread for stable resources";
496 } 503 }