Skip to content

Commit 82d5558

Browse files
committed
(release) v0.6.414 proper tracebacks
1 parent 6f11c0a commit 82d5558

4 files changed

Lines changed: 23 additions & 27 deletions

File tree

DearPyGui/src/core/PythonUtilities/mvPythonExceptions.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@ namespace Marvel
1111
void ThrowPythonException(const std::string& message)
1212
{
1313

14-
std::string fullMessage = "Line: %d \t" + message;
14+
std::string fullMessage = "Error: [%d] Message: \t" + message;
15+
PyErr_Format(PyExc_Exception, fullMessage.c_str(), 1000);
1516

16-
int line = 0;
17-
auto f = PyEval_GetFrame();
18-
if (f)
19-
line = PyFrame_GetLineNumber(f);
20-
else
21-
fullMessage.append(" || error occured in a callback");
22-
23-
PyErr_Format(PyExc_Exception, fullMessage.c_str(), line);
24-
PyErr_Print();
2517
}
2618

2719
}

DearPyGui/src/core/PythonUtilities/mvPythonParser.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,17 @@ namespace Marvel {
124124
if (!PyArg_VaParseTupleAndKeywords(args, kwargs, m_formatstring.data(),
125125
const_cast<char**>(m_keywords.data()), arguments))
126126
{
127-
PyErr_Print();
128127
check = false;
129-
mvAppLog::Show();
130-
int line = PyFrame_GetLineNumber(PyEval_GetFrame());
131-
PyObject* ex = PyErr_Format(PyExc_Exception,
132-
"Error parsing DearPyGui %s command on line %d.", message, line);
133-
PyErr_Print();
134-
Py_XDECREF(ex);
135128
}
136129

137130
va_end(arguments);
138131

132+
if (!check)
133+
{
134+
mvAppLog::Show();
135+
ThrowPythonException("Error parsing Dear PyGui command: " + std::string(message));
136+
}
137+
139138
return check;
140139
}
141140

DearPyGui/src/core/Registries/mvCallbackRegistry.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ namespace Marvel {
228228
if (data != nullptr)
229229
Py_XDECREF(data);
230230
ThrowPythonException("Callable not callable.");
231+
PyErr_Print();
231232
return;
232233
}
233234

@@ -239,7 +240,7 @@ namespace Marvel {
239240

240241
Py_XINCREF(data);
241242

242-
PyErr_Clear();
243+
//PyErr_Clear();
243244

244245
PyObject* intermediateResult = nullptr;
245246
if (PyCallable_Check(data))
@@ -249,18 +250,15 @@ namespace Marvel {
249250
if (intermediateResult == nullptr)
250251
{
251252
PyErr_Print();
252-
ThrowPythonException("Callable data failed");
253+
//ThrowPythonException("Callable data failed");
253254
intermediateResult = data;
254255
}
255256

256-
// check if error occurred
257-
if (PyErr_Occurred())
258-
PyErr_Print();
259257
}
260258
else
261259
intermediateResult = data;
262260

263-
PyErr_Clear();
261+
//PyErr_Clear();
264262

265263
PyObject* fc = PyObject_GetAttrString(callable, "__code__");
266264
if (fc) {
@@ -286,7 +284,7 @@ namespace Marvel {
286284
if (!result.isOk())
287285
{
288286
PyErr_Print();
289-
ThrowPythonException("Callable failed");
287+
//ThrowPythonException("Callable failed");
290288
}
291289

292290
}
@@ -302,7 +300,7 @@ namespace Marvel {
302300
if (!result.isOk())
303301
{
304302
PyErr_Print();
305-
ThrowPythonException("Callable failed");
303+
//ThrowPythonException("Callable failed");
306304
}
307305

308306
}
@@ -317,7 +315,7 @@ namespace Marvel {
317315
if (!result.isOk())
318316
{
319317
PyErr_Print();
320-
ThrowPythonException("Callable failed");
318+
//ThrowPythonException("Callable failed");
321319
}
322320
}
323321
else
@@ -328,7 +326,7 @@ namespace Marvel {
328326
if (!result.isOk())
329327
{
330328
PyErr_Print();
331-
ThrowPythonException("Callable failed");
329+
//ThrowPythonException("Callable failed");
332330
}
333331

334332

docs/CHANGELOG.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ HOW TO UPDATE?
2222
- Read the `Breaking Changes` section (here in the changelog).
2323
- Please report any issue!
2424

25+
------------------------------------------------------------------------
26+
VERSION 0.6.414
27+
------------------------------------------------------------------------
28+
Fixes:
29+
30+
- added proper tracebacks
31+
2532
------------------------------------------------------------------------
2633
VERSION 0.6.403
2734
------------------------------------------------------------------------

0 commit comments

Comments
 (0)