# HG changeset patch # User Sebastien Jodogne # Date 1543846302 -3600 # Node ID bfee0b9f32090c6900ae5753304e3ae8ddfeda96 # Parent bbfd95a0c4294ff52f5f3176bb7e01c096eb092f cont diff -r bbfd95a0c429 -r bfee0b9f3209 OrthancServer/OrthancConfiguration.cpp --- a/OrthancServer/OrthancConfiguration.cpp Mon Dec 03 14:59:23 2018 +0100 +++ b/OrthancServer/OrthancConfiguration.cpp Mon Dec 03 15:11:42 2018 +0100 @@ -134,12 +134,13 @@ { target = Json::objectValue; - if (configurationFile) + if (configurationFile != NULL) { if (!boost::filesystem::exists(configurationFile)) { - LOG(ERROR) << "Inexistent path to configuration: " << configurationFile; - throw OrthancException(ErrorCode_InexistentFile); + throw OrthancException(ErrorCode_InexistentFile, + "Inexistent path to configuration: " + + std::string(configurationFile)); } if (boost::filesystem::is_directory(configurationFile)) @@ -179,9 +180,9 @@ if (!isalnum(s[j]) && s[j] != '-') { - LOG(ERROR) << "Only alphanumeric and dash characters are allowed " - << "in the names of modalities/peers, but found: " << s; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "Only alphanumeric and dash characters are allowed " + "in the names of modalities/peers, but found: " + s); } } } @@ -193,8 +194,9 @@ if (source.type() != Json::objectValue) { - LOG(ERROR) << "Bad format of the \"" << DICOM_MODALITIES << "\" configuration section"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "Bad format of the \"" + std::string(DICOM_MODALITIES) + + "\" configuration section"); } Json::Value::Members members = source.getMemberNames(); @@ -217,8 +219,9 @@ if (source.type() != Json::objectValue) { - LOG(ERROR) << "Bad format of the \"" << ORTHANC_PEERS << "\" configuration section"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, + "Bad format of the \"" + std::string(ORTHANC_PEERS) + + "\" configuration section"); } Json::Value::Members members = source.getMemberNames(); @@ -256,8 +259,8 @@ } else { - LOG(ERROR) << "Cannot unserialize the list of modalities from the Orthanc database"; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Cannot unserialize the list of modalities from the Orthanc database"); } } } @@ -296,8 +299,8 @@ } else { - LOG(ERROR) << "Cannot unserialize the list of peers from the Orthanc database"; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Cannot unserialize the list of peers from the Orthanc database"); } } } @@ -424,8 +427,8 @@ { if (json_[parameter].type() != Json::stringValue) { - LOG(ERROR) << "The configuration option \"" << parameter << "\" must be a string"; - throw OrthancException(ErrorCode_BadParameterType); + throw OrthancException(ErrorCode_BadParameterType, + "The configuration option \"" + parameter + "\" must be a string"); } else { @@ -446,8 +449,8 @@ { if (json_[parameter].type() != Json::intValue) { - LOG(ERROR) << "The configuration option \"" << parameter << "\" must be an integer"; - throw OrthancException(ErrorCode_BadParameterType); + throw OrthancException(ErrorCode_BadParameterType, + "The configuration option \"" + parameter + "\" must be an integer"); } else { @@ -469,8 +472,8 @@ if (v < 0) { - LOG(ERROR) << "The configuration option \"" << parameter << "\" must be a positive integer"; - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_ParameterOutOfRange, + "The configuration option \"" + parameter + "\" must be a positive integer"); } else { @@ -486,9 +489,9 @@ { if (json_[parameter].type() != Json::booleanValue) { - LOG(ERROR) << "The configuration option \"" << parameter - << "\" must be a Boolean (true or false)"; - throw OrthancException(ErrorCode_BadParameterType); + throw OrthancException(ErrorCode_BadParameterType, + "The configuration option \"" + parameter + + "\" must be a Boolean (true or false)"); } else { @@ -555,8 +558,8 @@ if (found == modalities_.end()) { - LOG(ERROR) << "No modality with symbolic name: " << name; - throw OrthancException(ErrorCode_InexistentItem); + throw OrthancException(ErrorCode_InexistentItem, + "No modality with symbolic name: " + name); } else { @@ -618,8 +621,7 @@ const Json::Value& users = json_["RegisteredUsers"]; if (users.type() != Json::objectValue) { - LOG(ERROR) << "Badly formatted list of users"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of users"); } Json::Value::Members usernames = users.getMemberNames(); @@ -653,8 +655,7 @@ if (lst.type() != Json::arrayValue) { - LOG(ERROR) << "Badly formatted list of strings"; - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of strings"); } for (Json::Value::ArrayIndex i = 0; i < lst.size(); i++) @@ -747,8 +748,8 @@ } else { - LOG(ERROR) << "Unknown modality for AET: " << aet; - throw OrthancException(ErrorCode_InexistentItem); + throw OrthancException(ErrorCode_InexistentItem, + "Unknown modality for AET: " + aet); } } diff -r bbfd95a0c429 -r bfee0b9f3209 OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Mon Dec 03 14:59:23 2018 +0100 +++ b/OrthancServer/ServerContext.cpp Mon Dec 03 15:11:42 2018 +0100 @@ -538,8 +538,8 @@ if (!AddAttachment(instancePublicId, FileContentType_DicomAsJson, result.c_str(), result.size())) { - LOG(WARNING) << "Cannot associate the DICOM-as-JSON summary to instance: " << instancePublicId; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Cannot associate the DICOM-as-JSON summary to instance: " + instancePublicId); } } } @@ -598,8 +598,9 @@ FileInfo attachment; if (!index_.LookupAttachment(attachment, instancePublicId, content)) { - LOG(WARNING) << "Unable to read attachment " << EnumerationToString(content) << " of instance " << instancePublicId; - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_InternalError, + "Unable to read attachment " + EnumerationToString(content) + + " of instance " + instancePublicId); } if (uncompressIfNeeded) diff -r bbfd95a0c429 -r bfee0b9f3209 Plugins/Engine/OrthancPluginDatabase.cpp --- a/Plugins/Engine/OrthancPluginDatabase.cpp Mon Dec 03 14:59:23 2018 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Mon Dec 03 15:11:42 2018 +0100 @@ -280,8 +280,8 @@ { if (extensions_.getAllInternalIds == NULL) { - LOG(ERROR) << "The database plugin does not implement the GetAllInternalIds primitive"; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "The database plugin does not implement the GetAllInternalIds primitive"); } ResetAnswers(); @@ -618,8 +618,8 @@ { if (extensions_.lookupIdentifier3 == NULL) { - LOG(ERROR) << "The database plugin does not implement the LookupIdentifier3 primitive"; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "The database plugin does not implement the LookupIdentifier3 primitive"); } OrthancPluginDicomTag tmp; @@ -736,8 +736,8 @@ { if (extensions_.clearMainDicomTags == NULL) { - LOG(ERROR) << "Your custom index plugin does not implement the ClearMainDicomTags() extension"; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "Your custom index plugin does not implement the ClearMainDicomTags() extension"); } CheckSuccess(extensions_.clearMainDicomTags(payload_, id)); @@ -971,14 +971,15 @@ break; default: - LOG(ERROR) << "Unhandled type of answer for custom index plugin: " << answer.type; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "Unhandled type of answer for custom index plugin: " + + boost::lexical_cast(answer.type)); } } else if (type_ != answer.type) { - LOG(ERROR) << "Error in the plugin protocol: Cannot change the answer type"; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "Error in the plugin protocol: Cannot change the answer type"); } switch (answer.type) @@ -1098,8 +1099,9 @@ } default: - LOG(ERROR) << "Unhandled type of answer for custom index plugin: " << answer.type; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "Unhandled type of answer for custom index plugin: " + + boost::lexical_cast(answer.type)); } } } diff -r bbfd95a0c429 -r bfee0b9f3209 Plugins/Engine/OrthancPlugins.cpp --- a/Plugins/Engine/OrthancPlugins.cpp Mon Dec 03 14:59:23 2018 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Mon Dec 03 15:11:42 2018 +0100 @@ -733,7 +733,8 @@ OrthancPluginErrorCode error = apply_(driver_); if (error != OrthancPluginErrorCode_Success) { - LOG(ERROR) << "Error while doing C-Move from plugin: " << EnumerationToString(static_cast(error)); + LOG(ERROR) << "Error while doing C-Move from plugin: " + << EnumerationToString(static_cast(error)); return Status_Failure; } else @@ -816,8 +817,8 @@ if (driver == NULL) { - LOG(ERROR) << "Plugin cannot create a driver for an incoming C-MOVE request"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "Plugin cannot create a driver for an incoming C-MOVE request"); } unsigned int size = params_.getMoveSize(driver); @@ -1144,8 +1145,8 @@ if (pimpl_->worklistCallback_ != NULL) { - LOG(ERROR) << "Can only register one plugin to handle modality worklists"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "Can only register one plugin to handle modality worklists"); } else { @@ -1164,8 +1165,8 @@ if (pimpl_->findCallback_ != NULL) { - LOG(ERROR) << "Can only register one plugin to handle C-FIND requests"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "Can only register one plugin to handle C-FIND requests"); } else { @@ -1184,8 +1185,8 @@ if (pimpl_->moveCallbacks_.callback != NULL) { - LOG(ERROR) << "Can only register one plugin to handle C-MOVE requests"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "Can only register one plugin to handle C-MOVE requests"); } else { @@ -2320,8 +2321,8 @@ } else { - LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; - throw OrthancException(ErrorCode_BadRequest); + throw OrthancException(ErrorCode_BadRequest, + "Cannot invoke this service without a custom database back-end"); } } @@ -3195,8 +3196,8 @@ if (pimpl_->database_.get() == NULL) { - LOG(ERROR) << "The service ReconstructMainDicomTags can only be invoked by custom database plugins"; - throw OrthancException(ErrorCode_DatabasePlugin); + throw OrthancException(ErrorCode_DatabasePlugin, + "The service ReconstructMainDicomTags can only be invoked by custom database plugins"); } IStorageArea& storage = *reinterpret_cast(p.storageArea); diff -r bbfd95a0c429 -r bfee0b9f3209 Plugins/Engine/PluginsJob.cpp --- a/Plugins/Engine/PluginsJob.cpp Mon Dec 03 14:59:23 2018 +0100 +++ b/Plugins/Engine/PluginsJob.cpp Mon Dec 03 15:11:42 2018 +0100 @@ -148,8 +148,8 @@ if (!reader.parse(content, value) || value.type() != Json::objectValue) { - LOG(ERROR) << "A job plugin must provide a JSON object as its public content"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "A job plugin must provide a JSON object as its public content"); } } } @@ -169,8 +169,8 @@ if (!reader.parse(serialized, value) || value.type() != Json::objectValue) { - LOG(ERROR) << "A job plugin must provide a JSON object as its serialized content"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "A job plugin must provide a JSON object as its serialized content"); } @@ -178,8 +178,8 @@ if (value.isMember(KEY_TYPE)) { - LOG(ERROR) << "The \"Type\" field is for reserved use for serialized job"; - throw OrthancException(ErrorCode_Plugin); + throw OrthancException(ErrorCode_Plugin, + "The \"Type\" field is for reserved use for serialized job"); } value[KEY_TYPE] = type_;