# HG changeset patch # User Sebastien Jodogne # Date 1543845563 -3600 # Node ID bbfd95a0c4294ff52f5f3176bb7e01c096eb092f # Parent d924f9bb61ccab61057cdaba905b34921c352761 cont diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/DatabaseWrapper.cpp --- a/OrthancServer/DatabaseWrapper.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/DatabaseWrapper.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -366,8 +366,8 @@ if (!ok) { - LOG(ERROR) << "Incompatible version of the Orthanc database: " << tmp; - throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); + throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, + "Incompatible version of the Orthanc database: " + tmp); } signalRemainingAncestor_ = new Internals::SignalRemainingAncestor; diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/DicomInstanceToStore.cpp --- a/OrthancServer/DicomInstanceToStore.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/DicomInstanceToStore.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -188,8 +188,8 @@ if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer_.GetContent(), *parsed_.GetContent().GetDcmtkObject().getDataset())) { - LOG(ERROR) << "Unable to serialize a DICOM file to a memory buffer"; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Unable to serialize a DICOM file to a memory buffer"); } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/LuaScripting.cpp --- a/OrthancServer/LuaScripting.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/LuaScripting.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -472,8 +472,8 @@ } else { - LOG(ERROR) << "No peer with symbolic name: " << name; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "No peer with symbolic name: " + name); } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancConfiguration.cpp --- a/OrthancServer/OrthancConfiguration.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancConfiguration.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -71,8 +71,8 @@ if (!reader.parse(content, tmp) || tmp.type() != Json::objectValue) { - LOG(ERROR) << "The configuration file does not follow the JSON syntax: " << path; - throw OrthancException(ErrorCode_BadJson); + throw OrthancException(ErrorCode_BadJson, + "The configuration file does not follow the JSON syntax: " + path.string()); } Toolbox::CopyJsonWithoutComments(config, tmp); @@ -90,9 +90,9 @@ { if (target.isMember(members[i])) { - LOG(ERROR) << "The configuration section \"" << members[i] - << "\" is defined in 2 different configuration files"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "The configuration section \"" + members[i] + + "\" is defined in 2 different configuration files"); } else { diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancFindRequestHandler.cpp --- a/OrthancServer/OrthancFindRequestHandler.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancFindRequestHandler.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -552,8 +552,8 @@ levelTmp->IsNull() || levelTmp->IsBinary()) { - LOG(ERROR) << "C-FIND request without the tag 0008,0052 (QueryRetrieveLevel)"; - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException(ErrorCode_BadRequest, + "C-FIND request without the tag 0008,0052 (QueryRetrieveLevel)"); } ResourceType level = StringToResourceType(levelTmp->GetContent().c_str()); diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancInitialization.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -67,8 +67,8 @@ if (!parameter[name].isInt()) { - LOG(ERROR) << "Not a number in this user-defined metadata: " << name; - throw OrthancException(ErrorCode_BadParameterType); + throw OrthancException(ErrorCode_BadParameterType, + "Not a number in this user-defined metadata: " + name); } int metadata = parameter[name].asInt(); @@ -119,8 +119,8 @@ } else { - LOG(ERROR) << "Not a number in this user-defined attachment type: " << name; - throw OrthancException(ErrorCode_BadParameterType); + throw OrthancException(ErrorCode_BadParameterType, + "Not a number in this user-defined attachment type: " + name); } LOG(INFO) << "Registering user-defined attachment type: " << name << " (index " @@ -183,8 +183,9 @@ !config.isMember("Module") || config["Module"].type() != Json::stringValue) { - LOG(ERROR) << "No path to the PKCS#11 module (DLL or .so) is provided for HTTPS client authentication"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "No path to the PKCS#11 module (DLL or .so) is provided " + "for HTTPS client authentication"); } std::string pin; @@ -196,8 +197,8 @@ } else { - LOG(ERROR) << "The PIN number in the PKCS#11 configuration must be a string"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "The PIN number in the PKCS#11 configuration must be a string"); } } @@ -210,8 +211,8 @@ } else { - LOG(ERROR) << "The Verbose option in the PKCS#11 configuration must be a Boolean"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "The Verbose option in the PKCS#11 configuration must be a Boolean"); } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -271,8 +271,7 @@ { if (tags.type() != Json::objectValue) { - LOG(ERROR) << "Tags field is not an array"; - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException(ErrorCode_BadRequest, "Tags field is not an array"); } // Inject the user-specified tags @@ -410,8 +409,8 @@ const char* tmp = request["Tags"]["SpecificCharacterSet"].asCString(); if (!GetDicomEncoding(encoding, tmp)) { - LOG(ERROR) << "Unknown specific character set: " << std::string(tmp); - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_ParameterOutOfRange, + "Unknown specific character set: " + std::string(tmp)); } } else diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -924,8 +924,8 @@ } else { - LOG(ERROR) << "No peer with symbolic name: " << remote; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "No peer with symbolic name: " + remote); } } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -151,14 +151,16 @@ { if (!call.HasArgument("limit")) { - LOG(ERROR) << "Missing \"limit\" argument for GET request against: " << call.FlattenUri(); - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException(ErrorCode_BadRequest, + "Missing \"limit\" argument for GET request against: " + + call.FlattenUri()); } if (!call.HasArgument("since")) { - LOG(ERROR) << "Missing \"since\" argument for GET request against: " << call.FlattenUri(); - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException(ErrorCode_BadRequest, + "Missing \"since\" argument for GET request against: " + + call.FlattenUri()); } size_t since = boost::lexical_cast(call.GetArgument("since", "")); @@ -440,8 +442,9 @@ if (!ok) { - LOG(ERROR) << "Bad quality for a JPEG encoding (must be a number between 0 and 100): " << v; - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException( + ErrorCode_BadRequest, + "Bad quality for a JPEG encoding (must be a number between 0 and 100): " + v); } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/ServerJobs/ArchiveJob.cpp --- a/OrthancServer/ServerJobs/ArchiveJob.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/ServerJobs/ArchiveJob.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -812,8 +812,8 @@ void ArchiveJob::Reset() { - LOG(ERROR) << "Cannot resubmit the creation of an archive"; - throw OrthancException(ErrorCode_BadSequenceOfCalls); + throw OrthancException(ErrorCode_BadSequenceOfCalls, + "Cannot resubmit the creation of an archive"); } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/ServerJobs/MergeStudyJob.cpp --- a/OrthancServer/ServerJobs/MergeStudyJob.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/ServerJobs/MergeStudyJob.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -61,8 +61,8 @@ { if (study == targetStudy_) { - LOG(ERROR) << "Cannot merge a study into the same study: " << study; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "Cannot merge a study into the same study: " + study); } else { @@ -183,8 +183,8 @@ if (!context_.GetIndex().LookupResourceType(type, targetStudy) || type != ResourceType_Study) { - LOG(ERROR) << "Cannot merge into an unknown study: " << targetStudy; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "Cannot merge into an unknown study: " + targetStudy); } @@ -257,8 +257,8 @@ } else if (!context_.GetIndex().LookupResourceType(level, studyOrSeries)) { - LOG(ERROR) << "Cannot find this resource: " << studyOrSeries; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "Cannot find this resource: " + studyOrSeries); } else { @@ -273,9 +273,10 @@ break; default: - LOG(ERROR) << "This resource is neither a study, nor a series: " - << studyOrSeries << " is a " << EnumerationToString(level); - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "This resource is neither a study, nor a series: " + + studyOrSeries + " is a " + + std::string(EnumerationToString(level))); } } } @@ -291,14 +292,14 @@ } else if (!context_.GetIndex().LookupParent(parent, series, ResourceType_Study)) { - LOG(ERROR) << "This resource is not a series: " << series; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "This resource is not a series: " + series); } else if (parent == targetStudy_) { - LOG(ERROR) << "Cannot merge series " << series - << " into its parent study " << targetStudy_; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "Cannot merge series " + series + + " into its parent study " + targetStudy_); } else { @@ -318,8 +319,8 @@ else if (!context_.GetIndex().LookupResourceType(actualLevel, study) || actualLevel != ResourceType_Study) { - LOG(ERROR) << "This resource is not a study: " << study; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "This resource is not a study: " + study); } else { diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/ServerJobs/ResourceModificationJob.cpp --- a/OrthancServer/ServerJobs/ResourceModificationJob.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/ServerJobs/ResourceModificationJob.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -134,8 +134,8 @@ if (modification_.get() == NULL || output_.get() == NULL) { - LOG(ERROR) << "No modification was provided for this job"; - throw OrthancException(ErrorCode_BadSequenceOfCalls); + throw OrthancException(ErrorCode_BadSequenceOfCalls, + "No modification was provided for this job"); } @@ -212,8 +212,8 @@ std::string modifiedInstance; if (context_.Store(modifiedInstance, toStore) != StoreStatus_Success) { - LOG(ERROR) << "Error while storing a modified instance " << instance; - throw OrthancException(ErrorCode_CannotStoreInstance); + throw OrthancException(ErrorCode_CannotStoreInstance, + "Error while storing a modified instance " + instance); } assert(modifiedInstance == modifiedHasher.HashInstance()); diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/ServerJobs/SplitStudyJob.cpp --- a/OrthancServer/ServerJobs/SplitStudyJob.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/ServerJobs/SplitStudyJob.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -43,10 +43,11 @@ { if (allowedTags_.find(tag) == allowedTags_.end()) { - LOG(ERROR) << "Cannot modify the following tag while splitting a study " - << "(not in the patient/study modules): " - << FromDcmtkBridge::GetTagName(tag, "") << " (" << tag.Format() << ")"; - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_ParameterOutOfRange, + "Cannot modify the following tag while splitting a study " + "(not in the patient/study modules): " + + FromDcmtkBridge::GetTagName(tag, "") + + " (" + tag.Format() + ")"); } } @@ -173,8 +174,8 @@ if (!context_.GetIndex().LookupResourceType(type, sourceStudy) || type != ResourceType_Study) { - LOG(ERROR) << "Cannot split unknown study: " << sourceStudy; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "Cannot split unknown study " + sourceStudy); } } @@ -209,8 +210,8 @@ else if (!context_.GetIndex().LookupParent(parent, series, ResourceType_Study) || parent != sourceStudy_) { - LOG(ERROR) << "This series does not belong to the study to be split: " << series; - throw OrthancException(ErrorCode_UnknownResource); + throw OrthancException(ErrorCode_UnknownResource, + "This series does not belong to the study to be split: " + series); } else { diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/ServerToolbox.cpp --- a/OrthancServer/ServerToolbox.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/ServerToolbox.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -302,17 +302,19 @@ tmp != level || !FindOneChildInstance(instance, database, resource, level)) { - LOG(ERROR) << "Cannot find an instance for " << EnumerationToString(level) - << " with identifier " << *it; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Cannot find an instance for " + + std::string(EnumerationToString(level)) + + " with identifier " + *it); } // Get the DICOM file attached to some instances in the resource FileInfo attachment; if (!database.LookupAttachment(attachment, instance, FileContentType_Dicom)) { - LOG(ERROR) << "Cannot retrieve the DICOM file associated with instance " << database.GetPublicId(instance); - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Cannot retrieve the DICOM file associated with instance " + + database.GetPublicId(instance)); } try diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/SliceOrdering.cpp --- a/OrthancServer/SliceOrdering.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/SliceOrdering.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -407,8 +407,8 @@ if (!SortUsingPositions() && !SortUsingIndexInSeries()) { - LOG(ERROR) << "Unable to order the slices of the series " << seriesId; - throw OrthancException(ErrorCode_CannotOrderSlices); + throw OrthancException(ErrorCode_CannotOrderSlices, + "Unable to order the slices of series " + seriesId); } } diff -r d924f9bb61cc -r bbfd95a0c429 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Mon Dec 03 14:35:34 2018 +0100 +++ b/OrthancServer/main.cpp Mon Dec 03 14:59:23 2018 +0100 @@ -1003,9 +1003,10 @@ if (currentVersion > ORTHANC_DATABASE_VERSION) { - LOG(ERROR) << "The version of the database schema (" << currentVersion - << ") is too recent for this version of Orthanc. Please upgrade Orthanc."; - throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); + throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, + "The version of the database schema (" + + boost::lexical_cast(currentVersion) + + ") is too recent for this version of Orthanc. Please upgrade Orthanc."); } LOG(WARNING) << "Upgrading the database from schema version " @@ -1026,8 +1027,9 @@ currentVersion = database.GetDatabaseVersion(); if (ORTHANC_DATABASE_VERSION != currentVersion) { - LOG(ERROR) << "The database schema was not properly upgraded, it is still at version " << currentVersion; - throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); + throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, + "The database schema was not properly upgraded, it is still at version " + + boost::lexical_cast(currentVersion)); } else { @@ -1171,10 +1173,11 @@ } else if (currentVersion != ORTHANC_DATABASE_VERSION) { - LOG(ERROR) << "The database schema must be changed from version " - << currentVersion << " to " << ORTHANC_DATABASE_VERSION - << ": Please run Orthanc with the \"--upgrade\" argument"; - throw OrthancException(ErrorCode_IncompatibleDatabaseVersion); + throw OrthancException(ErrorCode_IncompatibleDatabaseVersion, + "The database schema must be changed from version " + + boost::lexical_cast(currentVersion) + " to " + + boost::lexical_cast(ORTHANC_DATABASE_VERSION) + + ": Please run Orthanc with the \"--upgrade\" argument"); } bool success = ConfigureServerContext