Mercurial > hg > orthanc
comparison Plugins/Engine/PluginsErrorDictionary.h @ 1649:8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 16:24:13 +0200 |
parents | 1558b3226b18 |
children | 9f34ebfaf2c9 |
comparison
equal
deleted
inserted
replaced
1648:a0a4fa28624c | 1649:8040d56cb0b3 |
---|---|
34 | 34 |
35 #if ORTHANC_PLUGINS_ENABLED == 1 | 35 #if ORTHANC_PLUGINS_ENABLED == 1 |
36 | 36 |
37 #include "../Include/orthanc/OrthancCPlugin.h" | 37 #include "../Include/orthanc/OrthancCPlugin.h" |
38 #include "../../Core/OrthancException.h" | 38 #include "../../Core/OrthancException.h" |
39 #include "SharedLibrary.h" | |
39 | 40 |
40 #include <map> | 41 #include <map> |
41 #include <string> | 42 #include <string> |
42 #include <boost/noncopyable.hpp> | 43 #include <boost/noncopyable.hpp> |
43 #include <boost/thread/mutex.hpp> | 44 #include <boost/thread/mutex.hpp> |
52 struct Error | 53 struct Error |
53 { | 54 { |
54 std::string pluginName_; | 55 std::string pluginName_; |
55 int32_t pluginCode_; | 56 int32_t pluginCode_; |
56 HttpStatus httpStatus_; | 57 HttpStatus httpStatus_; |
57 std::string description_; | 58 std::string message_; |
58 }; | 59 }; |
59 | 60 |
60 typedef std::map<int32_t, Error*> Errors; | 61 typedef std::map<int32_t, Error*> Errors; |
61 | 62 |
62 boost::mutex mutex_; | 63 boost::mutex mutex_; |
66 public: | 67 public: |
67 PluginsErrorDictionary(); | 68 PluginsErrorDictionary(); |
68 | 69 |
69 ~PluginsErrorDictionary(); | 70 ~PluginsErrorDictionary(); |
70 | 71 |
71 OrthancPluginErrorCode Register(const std::string& pluginName, | 72 OrthancPluginErrorCode Register(SharedLibrary& library, |
72 int32_t pluginCode, | 73 int32_t pluginCode, |
73 uint16_t httpStatus, | 74 uint16_t httpStatus, |
74 const char* description); | 75 const char* message); |
75 | 76 |
76 bool Format(Json::Value& message, /* out */ | 77 bool Format(Json::Value& message, /* out */ |
77 HttpStatus& httpStatus, /* out */ | 78 HttpStatus& httpStatus, /* out */ |
78 const OrthancException& exception); | 79 const OrthancException& exception); |
79 }; | 80 }; |
80 } | 81 } |
81 | 82 |