Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsErrorDictionary.cpp @ 1651:2e692c83e2f3
improved custom error login
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 17:29:39 +0200 |
parents | 9f34ebfaf2c9 |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1650:9f34ebfaf2c9 | 1651:2e692c83e2f3 |
---|---|
86 | 86 |
87 return code; | 87 return code; |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 void PluginsErrorDictionary::LogError(const OrthancException& exception) | 91 void PluginsErrorDictionary::LogError(ErrorCode code, |
92 bool ignoreBuiltinErrors) | |
92 { | 93 { |
93 if (exception.GetErrorCode() >= ErrorCode_START_PLUGINS) | 94 if (code >= ErrorCode_START_PLUGINS) |
94 { | 95 { |
95 boost::mutex::scoped_lock lock(mutex_); | 96 boost::mutex::scoped_lock lock(mutex_); |
96 Errors::const_iterator error = errors_.find(static_cast<int32_t>(exception.GetErrorCode())); | 97 Errors::const_iterator error = errors_.find(static_cast<int32_t>(code)); |
97 | 98 |
98 if (error != errors_.end()) | 99 if (error != errors_.end()) |
99 { | 100 { |
100 LOG(ERROR) << "Error code " << error->second->pluginCode_ | 101 LOG(ERROR) << "Error code " << error->second->pluginCode_ |
101 << " inside plugin \"" << error->second->pluginName_ | 102 << " inside plugin \"" << error->second->pluginName_ |
102 << "\": " << error->second->message_; | 103 << "\": " << error->second->message_; |
103 return; | 104 return; |
104 } | 105 } |
105 } | 106 } |
106 | 107 |
107 LOG(ERROR) << "Exception inside the plugin engine: " << exception.What(); | 108 if (!ignoreBuiltinErrors) |
109 { | |
110 LOG(ERROR) << "Exception inside the plugin engine: " | |
111 << EnumerationToString(code); | |
112 } | |
108 } | 113 } |
109 | 114 |
110 | 115 |
111 bool PluginsErrorDictionary::Format(Json::Value& message, /* out */ | 116 bool PluginsErrorDictionary::Format(Json::Value& message, /* out */ |
112 HttpStatus& httpStatus, /* out */ | 117 HttpStatus& httpStatus, /* out */ |