MCPcopy Create free account
hub / github.com/baldurk/renderdoc / HandleException

Function HandleException

qrenderdoc/Code/pyrenderdoc/PythonContext.cpp:1458–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456}
1457
1458extern "C" void HandleException(PyObject *global_handle)
1459{
1460 QString typeStr;
1461 QString valueStr;
1462 int finalLine = -1;
1463 QList<QString> frames;
1464
1465 FetchException(typeStr, valueStr, finalLine, frames);
1466
1467 OutputRedirector *redirector = (OutputRedirector *)global_handle;
1468 if(redirector && redirector->context)
1469 {
1470 emit redirector->context->exception(typeStr, valueStr, finalLine, frames);
1471 }
1472 else if(redirector && !redirector->context)
1473 {
1474 // if still NULL we're running in the extension context
1475 rdcstr exString;
1476
1477 if(!frames.isEmpty())
1478 {
1479 exString += "Traceback (most recent call last):\n";
1480 for(const QString &f : frames)
1481 {
1482 exString += " ";
1483 exString += f;
1484 exString += "\n";
1485 }
1486 }
1487
1488 exString += typeStr;
1489 exString += ": ";
1490 exString += valueStr;
1491 exString += "\n";
1492
1493 PyFrameObject *frame = PyEval_GetFrame();
1494
1495 QString filename = lit("unknown");
1496 int linenum = 0;
1497
1498 if(frame)
1499 {
1500 PyCodeObject *code = PyFrame_GetCode(frame);
1501 filename = ToQStr(code->co_filename);
1502 Py_XDECREF(code);
1503 linenum = PyFrame_GetLineNumber(frame);
1504 }
1505
1506 RENDERDOC_LogMessage(LogType::Error, "EXTN", filename, linenum, exString);
1507 }
1508}
1509
1510extern "C" bool IsThreadBlocking(PyObject *global_handle)
1511{

Callers 1

HandleCallbackFailureFunction · 0.70

Calls 5

FetchExceptionFunction · 0.85
PyFrame_GetCodeFunction · 0.85
RENDERDOC_LogMessageFunction · 0.85
ToQStrFunction · 0.70
isEmptyMethod · 0.45

Tested by

no test coverage detected