Fawkes API  Fawkes Development Version
fawkes::WebviewRestException Class Reference

REST processing exception. More...

#include <rest_api.h>

Inheritance diagram for fawkes::WebviewRestException:

Public Member Functions

 WebviewRestException (WebReply::Code code, const char *format,...)
 Constructor. More...
 
template<typename T , typename = std::enable_if_t<std::is_class<T>::value>>
 WebviewRestException (WebReply::Code code, const T &o, bool pretty=false)
 Constructor. More...
 
WebReply::Code code ()
 Get HTTP response code. More...
 
const std::string & content_type () const
 Get content type of response. More...
 
- Public Member Functions inherited from fawkes::Exception
 Exception (const char *format,...) throw ()
 Constructor. More...
 
 Exception (int errnoval, const char *format,...) throw ()
 Constructor. More...
 
 Exception (const Exception &exc) throw ()
 Copy constructor. More...
 
virtual ~Exception () throw ()
 Destructor. More...
 
virtual void raise ()
 This can be used to throw this exception. More...
 
void prepend (const char *format,...) throw ()
 Prepend messages to the message list. More...
 
void append (const char *format,...) throw ()
 Append messages to the message list. More...
 
void append_va (const char *format, va_list va) throw ()
 Append messages to the message list. More...
 
void append (const Exception &e) throw ()
 Append message that are from another Exception. More...
 
void print_trace () throw ()
 Prints trace to stderr. More...
 
void print_backtrace () const throw ()
 Prints a backtrace. More...
 
char * generate_backtrace () const throw ()
 Generate backtrace string. More...
 
int get_errno () throw ()
 Get errno. More...
 
void set_type_id (const char *id)
 Set exception type ID. More...
 
const char * type_id () const
 Get type ID. More...
 
virtual const char * what () const throw ()
 Get primary string. More...
 
virtual const char * what_no_backtrace () const throw ()
 Get primary string (does not implicitly print the back trace). More...
 
Exceptionoperator= (const Exception &exc) throw ()
 Assign an Exception. More...
 
iterator begin () throw ()
 Get iterator for messages. More...
 
iterator end () throw ()
 Get end iterator for messages. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::Exception
 Exception () throw ()
 Constructor for subclasses. More...
 
void append_nolock (const char *format,...) throw ()
 Append messages without lock. More...
 
void append_nolock_va (const char *format, va_list va) throw ()
 Append messages without lock by formatted string. More...
 
void append_nolock_nocopy (char *msg) throw ()
 Append message without copying. More...
 
void prepend_nolock_va (const char *format, va_list va) throw ()
 Prepend messages without lock by formatted string. More...
 
void copy_messages (const Exception &exc) throw ()
 Copy messages from given exception. More...
 
- Protected Attributes inherited from fawkes::Exception
message_list_tmessages
 
message_list_tmessages_iterator
 
message_list_tmessages_end
 
Mutexmessages_mutex
 
int _errno
 

Detailed Description

REST processing exception.

Use to indicate failure with more specific response. The HTTP code will be used for the static response with the formatted error message.

Author
Tim Niemueller

Definition at line 73 of file rest_api.h.

Constructor & Destructor Documentation

◆ WebviewRestException() [1/2]

fawkes::WebviewRestException::WebviewRestException ( WebReply::Code  code,
const char *  format,
  ... 
)
inlineexplicit

Constructor.

Parameters
codeHTTP response code
formatformat string for error message (cf. printf)

Definition at line 80 of file rest_api.h.

◆ WebviewRestException() [2/2]

template<typename T , typename = std::enable_if_t<std::is_class<T>::value>>
fawkes::WebviewRestException::WebviewRestException ( WebReply::Code  code,
const T &  o,
bool  pretty = false 
)
inline

Constructor.

Parameters
codeHTTP response code
oObject to convert to JSON
prettytrue to enable pretty printing of the JSON input

Definition at line 95 of file rest_api.h.

Member Function Documentation

◆ code()

WebReply::Code fawkes::WebviewRestException::code ( )
inline

Get HTTP response code.

Returns
HTTP response code

Definition at line 105 of file rest_api.h.

◆ content_type()

const std::string& fawkes::WebviewRestException::content_type ( ) const
inline

Get content type of response.

Returns
HTTP content type

Definition at line 114 of file rest_api.h.


The documentation for this class was generated from the following file: