An extension of server::handlers::CustomHandlerException that allows to specify a custom HttpStatus.
More...
#include <userver/server/http/http_error.hpp>
|
template<typename... Args> |
| CustomHandlerException (handlers::HandlerErrorCode error_code, HttpStatus http_status, Args &&... args) |
|
HttpStatus | GetHttpStatus () const |
|
Public Member Functions inherited from server::handlers::CustomHandlerException |
template<typename... Args> |
| CustomHandlerException (HandlerErrorCode handler_code, Args &&... args) |
| Construct manually from a set of (mostly optional) arguments, which describe the error details.
|
|
| CustomHandlerException (HandlerErrorCode handler_code) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| CustomHandlerException (ServiceErrorCode service_code, ExternalBody external_body, InternalMessage internal_message, HandlerErrorCode handler_code, ExtraHeaders headers={}, formats::json::Value details={}) |
|
template<typename MessageBuilder , typename = std::enable_if_t<impl::kIsMessageBuilder<MessageBuilder>>> |
| CustomHandlerException (MessageBuilder &&builder, HandlerErrorCode handler_code) |
|
HandlerErrorCode | GetCode () const |
|
const std::string & | GetServiceCode () const |
|
bool | IsExternalErrorBodyFormatted () const |
|
const std::string & | GetExternalErrorBody () const |
|
const formats::json::Value & | GetDetails () const |
|
const Headers & | GetExtraHeaders () const |
|
An extension of server::handlers::CustomHandlerException that allows to specify a custom HttpStatus.
For non-HTTP protocols, the status code will be derived from the attached server::handlers::HandlerErrorCode.
Definition at line 37 of file http_error.hpp.
◆ CustomHandlerException()
template<typename... Args>
- See also
- server::handlers::CustomHandlerException for the description of how
args
that can augment error messages.
server::http::HttpStatus::kUnprocessableEntity,
server::http::HttpStatus::kUnprocessableEntity);
EXPECT_EQ(exc.GetExternalErrorBody(), "The provided password is too short");
EXPECT_THAT(exc.what(), testing::HasSubstr("Client error"));
}
Definition at line 43 of file http_error.hpp.
◆ GetHttpStatus()
HttpStatus server::http::CustomHandlerException::GetHttpStatus |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: