Mercurial > hg > orthanc
diff OrthancFramework/Sources/OrthancException.h @ 4304:50b0c69b653a
continued abi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 16:33:52 +0100 |
parents | bf7b9edf6b81 |
children | d9473bd5ed43 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/OrthancException.h Fri Nov 06 15:37:30 2020 +0100 +++ b/OrthancFramework/Sources/OrthancException.h Fri Nov 06 16:33:52 2020 +0100 @@ -22,15 +22,10 @@ #pragma once -#include "Compatibility.h" +#include "Compatibility.h" // For std::unique_ptr<> #include "Enumerations.h" -#include "Logging.h" #include "OrthancFramework.h" -#include <stdint.h> -#include <string> -#include <memory> - namespace Orthanc { class ORTHANC_PUBLIC OrthancException @@ -47,90 +42,30 @@ std::unique_ptr<std::string> details_; public: - OrthancException(const OrthancException& other) : - errorCode_(other.errorCode_), - httpStatus_(other.httpStatus_) - { - if (other.details_.get() != NULL) - { - details_.reset(new std::string(*other.details_)); - } - } + OrthancException(const OrthancException& other); - explicit OrthancException(ErrorCode errorCode) : - errorCode_(errorCode), - httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)) - { - } + explicit OrthancException(ErrorCode errorCode); OrthancException(ErrorCode errorCode, const std::string& details, - bool log = true) : - errorCode_(errorCode), - httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)), - details_(new std::string(details)) - { -#if ORTHANC_ENABLE_LOGGING == 1 - if (log) - { - LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; - } -#endif - } + bool log = true); OrthancException(ErrorCode errorCode, - HttpStatus httpStatus) : - errorCode_(errorCode), - httpStatus_(httpStatus) - { - } + HttpStatus httpStatus); OrthancException(ErrorCode errorCode, HttpStatus httpStatus, const std::string& details, - bool log = true) : - errorCode_(errorCode), - httpStatus_(httpStatus), - details_(new std::string(details)) - { -#if ORTHANC_ENABLE_LOGGING == 1 - if (log) - { - LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; - } -#endif - } + bool log = true); - ErrorCode GetErrorCode() const - { - return errorCode_; - } + ErrorCode GetErrorCode() const; + + HttpStatus GetHttpStatus() const; - HttpStatus GetHttpStatus() const - { - return httpStatus_; - } - - const char* What() const - { - return EnumerationToString(errorCode_); - } + const char* What() const; - bool HasDetails() const - { - return details_.get() != NULL; - } + bool HasDetails() const; - const char* GetDetails() const - { - if (details_.get() == NULL) - { - return ""; - } - else - { - return details_->c_str(); - } - } + const char* GetDetails() const; }; }