Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsErrorDictionary.cpp @ 1650:9f34ebfaf2c9
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 16:47:05 +0200 |
parents | 8040d56cb0b3 |
children | 2e692c83e2f3 |
comparison
equal
deleted
inserted
replaced
1649:8040d56cb0b3 | 1650:9f34ebfaf2c9 |
---|---|
39 | 39 |
40 | 40 |
41 | 41 |
42 #include "PluginsEnumerations.h" | 42 #include "PluginsEnumerations.h" |
43 #include "PluginsManager.h" | 43 #include "PluginsManager.h" |
44 #include "../../Core/Logging.h" | |
44 | 45 |
45 #include <memory> | 46 #include <memory> |
46 | 47 |
47 | 48 |
48 namespace Orthanc | 49 namespace Orthanc |
85 | 86 |
86 return code; | 87 return code; |
87 } | 88 } |
88 | 89 |
89 | 90 |
91 void PluginsErrorDictionary::LogError(const OrthancException& exception) | |
92 { | |
93 if (exception.GetErrorCode() >= ErrorCode_START_PLUGINS) | |
94 { | |
95 boost::mutex::scoped_lock lock(mutex_); | |
96 Errors::const_iterator error = errors_.find(static_cast<int32_t>(exception.GetErrorCode())); | |
97 | |
98 if (error != errors_.end()) | |
99 { | |
100 LOG(ERROR) << "Error code " << error->second->pluginCode_ | |
101 << " inside plugin \"" << error->second->pluginName_ | |
102 << "\": " << error->second->message_; | |
103 return; | |
104 } | |
105 } | |
106 | |
107 LOG(ERROR) << "Exception inside the plugin engine: " << exception.What(); | |
108 } | |
109 | |
110 | |
90 bool PluginsErrorDictionary::Format(Json::Value& message, /* out */ | 111 bool PluginsErrorDictionary::Format(Json::Value& message, /* out */ |
91 HttpStatus& httpStatus, /* out */ | 112 HttpStatus& httpStatus, /* out */ |
92 const OrthancException& exception) | 113 const OrthancException& exception) |
93 { | 114 { |
94 if (exception.GetErrorCode() >= ErrorCode_START_PLUGINS) | 115 if (exception.GetErrorCode() >= ErrorCode_START_PLUGINS) |