Sha256: 350b33f19db2c50db9981166fb575b65950c6c8b1dd9ed2c4bb1583f922bd3d7

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

#include "rp_error.h"
#include "ptor.h"

VALUE ePythonError;
VALUE eRubyPyError;

void rpPythonError()
{
	PyObject *pType,*pValue,*pTraceback;
	PyObject *pTypeName;
	
	PyErr_Fetch(&pType,&pValue,&pTraceback);
	
	pTypeName = PyObject_GetAttrString(pType,"__name__");
	Py_XDECREF(pType);
	
	rb_raise(ePythonError,"%s:(%s)\n", STR2CSTR(ptorObject(pTypeName)), STR2CSTR(rb_inspect(ptorObject(pValue))));
	
	Py_XDECREF(pTraceback);
}

void rpRubyPyError(char* eString) {
	rb_raise(eRubyPyError, eString);
}

/*
Used to pass error information back into Ruby should an error occur in the embedded Python
interpreter.
*/
inline void Init_RubyPyError()
{
	ePythonError = rb_define_class("PythonError", rb_eException);
	eRubyPyError = rb_define_class("RubyPyError", rb_eException);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubypython-0.2.11 ext/rubypython_bridge/rp_error.c