annotate Framework/StoneException.h @ 436:04711a2e12cd am-vsol-upgrade

fix crop + export photometric interpretation correctly
author am@osimis.io
date Thu, 06 Dec 2018 11:53:37 +0100
parents 3a4ca166fafa
children b70e9be013e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
1 /**
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
6 *
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
11 *
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
16 *
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
19 **/
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
20
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
21
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
22 #pragma once
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
23
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
24 #include "Core/OrthancException.h"
297
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
25 #include <boost/lexical_cast.hpp>
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
26
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
27 namespace OrthancStone
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
28 {
297
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
29 enum ErrorCode
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
30 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
31 ErrorCode_Success,
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
32 ErrorCode_OrthancError, // this StoneException is actually an OrthancException with an Orthanc error code
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
33 ErrorCode_ApplicationException, // this StoneException is specific to an application (and should have its own internal error code)
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
34 ErrorCode_NotImplemented, // case not implemented
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 297
diff changeset
35
297
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
36 ErrorCode_PromiseSingleSuccessHandler, // a Promise can only have a single success handler
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
37 ErrorCode_PromiseSingleFailureHandler, // a Promise can only have a single failure handler
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
38
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 307
diff changeset
39 ErrorCode_CanOnlyAddOneLayerAtATime,
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 297
diff changeset
40 ErrorCode_CommandJsonInvalidFormat,
297
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
41 ErrorCode_Last
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
42 };
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
43
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
44
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
45
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
46 class StoneException
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
47 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
48 protected:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
49 OrthancStone::ErrorCode errorCode_;
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
50
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
51 public:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
52 explicit StoneException(ErrorCode errorCode) :
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
53 errorCode_(errorCode)
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
54 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
55 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
56
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
57 ErrorCode GetErrorCode() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
58 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
59 return errorCode_;
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
60 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
61
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
62 virtual const char* What() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
63 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
64 return "TODO: EnumerationToString for StoneException";
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
65 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
66 };
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
67
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
68 class StoneOrthancException : public StoneException
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
69 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
70 protected:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
71 Orthanc::OrthancException& orthancException_;
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
72
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
73 public:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
74 explicit StoneOrthancException(Orthanc::OrthancException& orthancException) :
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
75 StoneException(ErrorCode_OrthancError),
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
76 orthancException_(orthancException)
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
77 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
78 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
79
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
80 Orthanc::ErrorCode GetOrthancErrorCode() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
81 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
82 return orthancException_.GetErrorCode();
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
83 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
84
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
85 virtual const char* What() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
86 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
87 return orthancException_.What();
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
88 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
89 };
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
90
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
91 class StoneApplicationException : public StoneException
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
92 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
93 protected:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
94 int applicationErrorCode_;
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
95
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
96 public:
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
97 explicit StoneApplicationException(int applicationErrorCode) :
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
98 StoneException(ErrorCode_ApplicationException),
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
99 applicationErrorCode_(applicationErrorCode)
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
100 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
101 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
102
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
103 int GetApplicationErrorCode() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
104 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
105 return applicationErrorCode_;
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
106 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
107
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
108 virtual const char* What() const
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
109 {
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
110 return boost::lexical_cast<std::string>(applicationErrorCode_).c_str();
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
111 }
1992f7b8563e introduced StoneException
am@osimis.io
parents: 295
diff changeset
112 };
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
113
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
114 }
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
115