Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 1651:2e692c83e2f3
improved custom error login
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 17:29:39 +0200 |
parents | 8040d56cb0b3 |
children | 5360cdba70d8 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Fri Sep 25 16:47:05 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Fri Sep 25 17:29:39 2015 +0200 @@ -66,6 +66,7 @@ { private: _OrthancPluginRegisterStorageArea callbacks_; + PluginsErrorDictionary& errorDictionary_; void Free(void* buffer) const { @@ -76,7 +77,10 @@ } public: - PluginStorageArea(const _OrthancPluginRegisterStorageArea& callbacks) : callbacks_(callbacks) + PluginStorageArea(const _OrthancPluginRegisterStorageArea& callbacks, + PluginsErrorDictionary& errorDictionary) : + callbacks_(callbacks), + errorDictionary_(errorDictionary) { } @@ -91,6 +95,7 @@ if (error != OrthancPluginErrorCode_Success) { + errorDictionary_.LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } } @@ -108,6 +113,7 @@ if (error != OrthancPluginErrorCode_Success) { + errorDictionary_.LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } @@ -138,6 +144,7 @@ if (error != OrthancPluginErrorCode_Success) { + errorDictionary_.LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } } @@ -149,12 +156,15 @@ private: SharedLibrary& sharedLibrary_; _OrthancPluginRegisterStorageArea callbacks_; + PluginsErrorDictionary& errorDictionary_; public: StorageAreaFactory(SharedLibrary& sharedLibrary, - const _OrthancPluginRegisterStorageArea& callbacks) : + const _OrthancPluginRegisterStorageArea& callbacks, + PluginsErrorDictionary& errorDictionary) : sharedLibrary_(sharedLibrary), - callbacks_(callbacks) + callbacks_(callbacks), + errorDictionary_(errorDictionary) { } @@ -165,7 +175,7 @@ IStorageArea* Create() const { - return new PluginStorageArea(callbacks_); + return new PluginStorageArea(callbacks_, errorDictionary_); } }; } @@ -464,6 +474,7 @@ } else { + GetErrorDictionary().LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } } @@ -485,6 +496,7 @@ if (error != OrthancPluginErrorCode_Success) { + GetErrorDictionary().LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } } @@ -507,6 +519,7 @@ if (error != OrthancPluginErrorCode_Success) { + GetErrorDictionary().LogError(error, true); throw OrthancException(static_cast<ErrorCode>(error)); } } @@ -1378,7 +1391,7 @@ if (pimpl_->storageArea_.get() == NULL) { - pimpl_->storageArea_.reset(new StorageAreaFactory(plugin, p)); + pimpl_->storageArea_.reset(new StorageAreaFactory(plugin, p, GetErrorDictionary())); } else { @@ -1457,7 +1470,8 @@ if (pimpl_->database_.get() == NULL) { - pimpl_->database_.reset(new OrthancPluginDatabase(plugin, *p.backend, NULL, 0, p.payload)); + pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), + *p.backend, NULL, 0, p.payload)); } else { @@ -1478,7 +1492,8 @@ if (pimpl_->database_.get() == NULL) { - pimpl_->database_.reset(new OrthancPluginDatabase(plugin, *p.backend, p.extensions, + pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), + *p.backend, p.extensions, p.extensionsSize, p.payload)); } else