7#ifndef PXR_BASE_TF_PY_ERROR_H
8#define PXR_BASE_TF_PY_ERROR_H
15#include "pxr/base/tf/api.h"
18#include "pxr/external/boost/python/default_call_policies.hpp"
20PXR_NAMESPACE_OPEN_SCOPE
26bool TfPyConvertTfErrorsToPythonException(
TfErrorMark const &m);
32void TfPyConvertPythonExceptionToTfErrors();
45template <
typename Base = pxr_boost::python::default_call_policies>
59 template <
class BaseArgs>
60 struct ErrorMarkAndArgs {
61 ErrorMarkAndArgs(BaseArgs base_) : base(base_) {}
62 operator const BaseArgs &()
const {
return base; }
63 operator BaseArgs &() {
return base; }
67 typedef ErrorMarkAndArgs<typename Base::argument_package> argument_package;
74 bool precall(argument_package
const &a) {
return Base::precall(a); }
78 PyObject *postcall(argument_package
const &a, PyObject *result) {
79 result = Base::postcall(a, result);
80 if (result && TfPyConvertTfErrorsToPythonException(a.errorMark)) {
88PXR_NAMESPACE_CLOSE_SCOPE
Class used to record the end of the error-list.
A boost.python call policy class which, when applied to a wrapped function, will create an error mark...
TfPyRaiseOnError()
Default constructor.