Scarab  v2.9.1
Project 8 C++ Utility Library
Public Member Functions | Private Attributes | List of all members
error_already_set Class Reference

#include <pytypes.h>

Inheritance diagram for error_already_set:
Inheritance graph

Public Member Functions

 error_already_set ()
 
 error_already_set (const error_already_set &)=default
 
 error_already_set (error_already_set &&)=default
 
 ~error_already_set ()
 
void restore ()
 
 __attribute__ ((deprecated("Use of error_already_set.clear() is deprecated"))) void clear()
 
bool matches (handle exc) const
 
const objecttype () const
 
const objectvalue () const
 
const objecttrace () const
 

Private Attributes

object m_type
 
object m_value
 
object m_trace
 

Detailed Description

Fetch and hold an error which was already set in Python. An instance of this is typically thrown to propagate python-side errors back through C++ which can either be caught manually or else falls back to the function dispatcher (which then raises the captured error back to python).

Definition at line 322 of file pytypes.h.

Constructor & Destructor Documentation

◆ error_already_set() [1/3]

error_already_set ( )
inline

Constructs a new exception from the current Python error indicator, if any. The current Python error indicator will be cleared.

Definition at line 326 of file pytypes.h.

◆ error_already_set() [2/3]

error_already_set ( const error_already_set )
default

◆ error_already_set() [3/3]

◆ ~error_already_set()

~error_already_set ( )
inline

Definition at line 1999 of file pybind11.h.

Member Function Documentation

◆ __attribute__()

__attribute__ ( (deprecated("Use of error_already_set.clear() is deprecated"))  )
inline

Definition at line 341 of file pytypes.h.

◆ matches()

bool matches ( handle  exc) const
inline

Check if the currently trapped error type matches the given Python exception class (or a subclass thereof). May also be passed a tuple to search for any exception class matches in the given tuple.

Definition at line 347 of file pytypes.h.

◆ restore()

void restore ( )
inline

Give the currently-held error back to Python, if any. If there is currently a Python error already set it is cleared first. After this call, the current object no longer stores the error variables (but the .what() string is still available).

Definition at line 338 of file pytypes.h.

◆ trace()

const object& trace ( ) const
inline

Definition at line 351 of file pytypes.h.

◆ type()

const object& type ( ) const
inline

Definition at line 349 of file pytypes.h.

◆ value()

const object& value ( ) const
inline

Definition at line 350 of file pytypes.h.

Member Data Documentation

◆ m_trace

object m_trace
private

Definition at line 354 of file pytypes.h.

◆ m_type

object m_type
private

Definition at line 354 of file pytypes.h.

◆ m_value

object m_value
private

Definition at line 354 of file pytypes.h.


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