# ErrorHandler.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/server/handler/ErrorHandler.hpp"

# ErrorHandler

Error Handler.

namespace oatpp { namespace web { namespace server { namespace handler { 
  class ErrorHandler {}
}}}}

# Typedefs

Type Name Summary
web::protocol::http::Headers Headers Convenience typedef for Headers.
See oatpp::web::protocol::http::Headers

# Methods

Return Type Name Summary
[none] ~ErrorHandler Virtual destructor since the class is ment to be derived from.
std::shared_ptr<protocol::http::outgoing::Response> handleError Multiple implementations:
  1. Implement this method!
  2. Convenience method to call handleError method with no headers.

# ErrorHandler::Headers

Convenience typedef for Headers.
See oatpp::web::protocol::http::Headers

typedef web::protocol::http::Headers Headers

# ErrorHandler::~ErrorHandler

Virtual destructor since the class is ment to be derived from. */

virtual ~ErrorHandler() = default

# ErrorHandler::handleError

  1. Implement this method!
    virtual
    std::shared_ptr<protocol::http::outgoing::Response>
    handleError(const protocol::http::Status& status, const oatpp::String& message, const Headers& headers) = 0
    
  2. Convenience method to call handleError method with no headers.
    std::shared_ptr<protocol::http::outgoing::Response> handleError(const protocol::http::Status& status, const oatpp::String& message)
    

# DefaultErrorHandler

Default Error Handler.

namespace oatpp { namespace web { namespace server { namespace handler { 
  class DefaultErrorHandler : public oatpp::base::Countable, public ErrorHandler {}
}}}}

# Methods

Return Type Name Summary
[none] DefaultErrorHandler Constructor.
std::shared_ptr<DefaultErrorHandler> createShared Create shared DefaultErrorHandler.
std::shared_ptr<protocol::http::outgoing::Response> handleError Implementation of ErrorHandler::handleError()

# DefaultErrorHandler::DefaultErrorHandler

Constructor.

DefaultErrorHandler()

# DefaultErrorHandler::createShared

Create shared DefaultErrorHandler.

  • @return - std::shared_ptr to DefaultErrorHandler.

static std::shared_ptr<DefaultErrorHandler> createShared()

# DefaultErrorHandler::handleError

Implementation of ErrorHandler::handleError()

std::shared_ptr<protocol::http::outgoing::Response>
handleError(const protocol::http::Status& status, const oatpp::String& message, const Headers& headers) override