Mercurial > hg > orthanc
diff Core/RestApi/RestApiOutput.cpp @ 1567:9c5d93510414
If error while calling the REST API, the answer body contains an error description
author | jodogne |
---|---|
date | Sun, 23 Aug 2015 09:49:16 +0200 |
parents | 3606278d305e |
children | bd1889029cbb |
line wrap: on
line diff
--- a/Core/RestApi/RestApiOutput.cpp Fri Aug 21 17:37:13 2015 +0200 +++ b/Core/RestApi/RestApiOutput.cpp Sun Aug 23 09:49:16 2015 +0200 @@ -135,7 +135,9 @@ alreadySent_ = true; } - void RestApiOutput::SignalError(HttpStatus status) + void RestApiOutput::SignalErrorInternal(HttpStatus status, + const char* message, + size_t messageSize) { if (status != HttpStatus_400_BadRequest && status != HttpStatus_403_Forbidden && @@ -146,10 +148,21 @@ } CheckStatus(); - output_.SendStatus(status); + output_.SendStatus(status, message, messageSize); alreadySent_ = true; } + void RestApiOutput::SignalError(HttpStatus status) + { + SignalErrorInternal(status, NULL, 0); + } + + void RestApiOutput::SignalError(HttpStatus status, + const std::string& message) + { + SignalErrorInternal(status, message.c_str(), message.size()); + } + void RestApiOutput::SetCookie(const std::string& name, const std::string& value, unsigned int maxAge)