comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 2956:bfee0b9f3209

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 15:11:42 +0100
parents e583478e0c6c
children 8336204d95dc 4e43e67f8ecf
comparison
equal deleted inserted replaced
2955:bbfd95a0c429 2956:bfee0b9f3209
278 void OrthancPluginDatabase::GetAllInternalIds(std::list<int64_t>& target, 278 void OrthancPluginDatabase::GetAllInternalIds(std::list<int64_t>& target,
279 ResourceType resourceType) 279 ResourceType resourceType)
280 { 280 {
281 if (extensions_.getAllInternalIds == NULL) 281 if (extensions_.getAllInternalIds == NULL)
282 { 282 {
283 LOG(ERROR) << "The database plugin does not implement the GetAllInternalIds primitive"; 283 throw OrthancException(ErrorCode_DatabasePlugin,
284 throw OrthancException(ErrorCode_DatabasePlugin); 284 "The database plugin does not implement the GetAllInternalIds primitive");
285 } 285 }
286 286
287 ResetAnswers(); 287 ResetAnswers();
288 CheckSuccess(extensions_.getAllInternalIds(GetContext(), payload_, Plugins::Convert(resourceType))); 288 CheckSuccess(extensions_.getAllInternalIds(GetContext(), payload_, Plugins::Convert(resourceType)));
289 ForwardAnswers(target); 289 ForwardAnswers(target);
616 IdentifierConstraintType type, 616 IdentifierConstraintType type,
617 const std::string& value) 617 const std::string& value)
618 { 618 {
619 if (extensions_.lookupIdentifier3 == NULL) 619 if (extensions_.lookupIdentifier3 == NULL)
620 { 620 {
621 LOG(ERROR) << "The database plugin does not implement the LookupIdentifier3 primitive"; 621 throw OrthancException(ErrorCode_DatabasePlugin,
622 throw OrthancException(ErrorCode_DatabasePlugin); 622 "The database plugin does not implement the LookupIdentifier3 primitive");
623 } 623 }
624 624
625 OrthancPluginDicomTag tmp; 625 OrthancPluginDicomTag tmp;
626 tmp.group = tag.GetGroup(); 626 tmp.group = tag.GetGroup();
627 tmp.element = tag.GetElement(); 627 tmp.element = tag.GetElement();
734 734
735 void OrthancPluginDatabase::ClearMainDicomTags(int64_t id) 735 void OrthancPluginDatabase::ClearMainDicomTags(int64_t id)
736 { 736 {
737 if (extensions_.clearMainDicomTags == NULL) 737 if (extensions_.clearMainDicomTags == NULL)
738 { 738 {
739 LOG(ERROR) << "Your custom index plugin does not implement the ClearMainDicomTags() extension"; 739 throw OrthancException(ErrorCode_DatabasePlugin,
740 throw OrthancException(ErrorCode_DatabasePlugin); 740 "Your custom index plugin does not implement the ClearMainDicomTags() extension");
741 } 741 }
742 742
743 CheckSuccess(extensions_.clearMainDicomTags(payload_, id)); 743 CheckSuccess(extensions_.clearMainDicomTags(payload_, id));
744 } 744 }
745 745
969 assert(answerExportedResources_ != NULL); 969 assert(answerExportedResources_ != NULL);
970 answerExportedResources_->clear(); 970 answerExportedResources_->clear();
971 break; 971 break;
972 972
973 default: 973 default:
974 LOG(ERROR) << "Unhandled type of answer for custom index plugin: " << answer.type; 974 throw OrthancException(ErrorCode_DatabasePlugin,
975 throw OrthancException(ErrorCode_DatabasePlugin); 975 "Unhandled type of answer for custom index plugin: " +
976 boost::lexical_cast<std::string>(answer.type));
976 } 977 }
977 } 978 }
978 else if (type_ != answer.type) 979 else if (type_ != answer.type)
979 { 980 {
980 LOG(ERROR) << "Error in the plugin protocol: Cannot change the answer type"; 981 throw OrthancException(ErrorCode_DatabasePlugin,
981 throw OrthancException(ErrorCode_DatabasePlugin); 982 "Error in the plugin protocol: Cannot change the answer type");
982 } 983 }
983 984
984 switch (answer.type) 985 switch (answer.type)
985 { 986 {
986 case _OrthancPluginDatabaseAnswerType_Int32: 987 case _OrthancPluginDatabaseAnswerType_Int32:
1096 1097
1097 break; 1098 break;
1098 } 1099 }
1099 1100
1100 default: 1101 default:
1101 LOG(ERROR) << "Unhandled type of answer for custom index plugin: " << answer.type; 1102 throw OrthancException(ErrorCode_DatabasePlugin,
1102 throw OrthancException(ErrorCode_DatabasePlugin); 1103 "Unhandled type of answer for custom index plugin: " +
1104 boost::lexical_cast<std::string>(answer.type));
1103 } 1105 }
1104 } 1106 }
1105 } 1107 }