annotate Orthanc/Core/OrthancException.h @ 89:bc05500ea317

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Nov 2015 09:34:49 +0100
parents d6da56f86e5a
children 3809121c3290
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include <stdint.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include <string>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "Enumerations.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 protected:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ErrorCode errorCode_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 HttpStatus httpStatus_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 public:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 OrthancException(ErrorCode errorCode) :
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 errorCode_(errorCode),
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 httpStatus_(ConvertErrorCodeToHttpStatus(errorCode))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 OrthancException(ErrorCode errorCode,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 HttpStatus httpStatus) :
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 errorCode_(errorCode),
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 httpStatus_(httpStatus)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ErrorCode GetErrorCode() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 return errorCode_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 HttpStatus GetHttpStatus() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 return httpStatus_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 const char* What() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 return EnumerationToString(errorCode_);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 };
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }