![]() |
zeep::http::error_handler — A base class for error-handler classes.
// In header: <zeep/http/error-handler.hpp> class error_handler { public: // construct/copy/destruct error_handler(const std::string & = "error.xhtml"); error_handler(const error_handler &) = delete; error_handler & operator=(const error_handler &) = delete; ~error_handler(); // public member functions void set_server(server *); server * get_server(); const server * get_server() const; virtual bool create_error_reply(const request &, std::exception_ptr, reply &); virtual bool create_unauth_reply(const request &, reply &); virtual bool create_error_reply(const request &, status_type, reply &); virtual bool create_error_reply(const request &, status_type, const std::string &, reply &); };
To handle errors decently when there are multiple controllers.
error_handler
public
construct/copy/destructerror_handler(const std::string & error_template = "error.xhtml");constructor
If error_template is not empty, the error handler will try to load this XHTML template using the server's template_processor. If that fails or error_template is empty, a simple stock message is returned.
error_handler(const error_handler &) = delete;
error_handler & operator=(const error_handler &) = delete;
~error_handler();
error_handler
public member functionsvoid set_server(server * s);set the server object we're bound to
server * get_server();get the server object we're bound to
const server * get_server() const;set the server object we're bound to
virtual bool create_error_reply(const request & req, std::exception_ptr eptr, reply & reply);Create an error reply for an exception.
This function is called by server with the captured exception.
Parameters: |
|
||||
Returns: |
Return true if the reply was created successfully |
virtual bool create_unauth_reply(const request & req, reply & reply);Create an error reply for the error containing a validation header.
When a authentication violation is encountered, this function is called to generate the appropriate reply.
Parameters: |
|
||
Returns: |
Return true if the reply was created successfully |
virtual bool create_error_reply(const request & req, status_type status, reply & reply);Create an error reply for the error.
An error should be returned with HTTP status code status. This method will create a default error page.
Parameters: |
|
||||
Returns: |
Return true if the reply was created successfully |
virtual bool create_error_reply(const request & req, status_type status, const std::string & message, reply & reply);Create an error reply for the error with an additional message for the user.
An error should be returned with HTTP status code status and additional information message. This method will create a default error page.
Parameters: |
|
||||||
Returns: |
Return true if the reply was created successfully |