source/bases/Win32GUI.c
//-----------------------------------------------------------------------------
// FatalPythonErrorNoTraceback()
//   Handle a fatal Python error without traceback.
//-----------------------------------------------------------------------------
FatalPythonErrorNoTraceback()
Handle a fatal Python error without traceback.
FatalPythonErrorNoTraceback () Handle a fatal Python error without traceback .
static int FatalPythonErrorNoTraceback(PyObject *origValue,
        char *contextMessage)
{
    PyObject *contextMessageObj, *message, *format, *formatArgs, *caption;
    PyObject *type, *value, *traceback;
    PyErr_Fetch(&type, &value, &traceback);
    PyErr_NormalizeException(&type, &value, &traceback);
    contextMessageObj = PyUnicode_FromString(contextMessage);
    if (!contextMessageObj)
        return FatalError("Cannot create context message string object.");
    format = PyUnicode_FromString("%s\nException: %s\nOriginal Exception: %s");
    if (!format)
        return FatalError("Cannot create format string object.");
    formatArgs = PyTuple_New(3);
    if (!formatArgs)
        return FatalError("Cannot create format args tuple.");
    PyTuple_SET_ITEM(formatArgs, 0, ArgumentValue(contextMessageObj));
    PyTuple_SET_ITEM(formatArgs, 1, ArgumentValue(value));
    PyTuple_SET_ITEM(formatArgs, 2, ArgumentValue(origValue));
    message = PyUnicode_Format(format, formatArgs);
    if (!message)
        return FatalError("Cannot format exception values.");
    caption = PyUnicode_FromString("cx_Freeze: Python error in main script "
            "(traceback unavailable)");
    if (!caption)
        return FatalError("Cannot create caption string object.");
    return DisplayMessageFromPythonObjects(caption, message);
}
static int FatalPythonErrorNoTraceback ( PyObject * origValue , char * contextMessage ) { PyObject * contextMessageObj , * message , * format , * formatArgs , * caption ; PyObject * type , * value , * traceback ; PyErr_Fetch ( & type , & value , & traceback ) ; PyErr_NormalizeException ( & type , & value , & traceback ) ; contextMessageObj = PyUnicode_FromString ( contextMessage ) ; if ( ! contextMessageObj ) return FatalError ( " " ) ; format = PyUnicode_FromString ( " \n \n " ) ; if ( ! format ) return FatalError ( " " ) ; formatArgs = PyTuple_New ( 3 ) ; if ( ! formatArgs ) return FatalError ( " " ) ; PyTuple_SET_ITEM ( formatArgs , 0 , ArgumentValue ( contextMessageObj ) ) ; PyTuple_SET_ITEM ( formatArgs , 1 , ArgumentValue ( value ) ) ; PyTuple_SET_ITEM ( formatArgs , 2 , ArgumentValue ( origValue ) ) ; message = PyUnicode_Format ( format , formatArgs ) ; if ( ! message ) return FatalError ( " " ) ; caption = PyUnicode_FromString ( " " " " ) ; if ( ! caption ) return FatalError ( " " ) ; return DisplayMessageFromPythonObjects ( caption , message ) ; }
FatalPythonErrorNoTraceback()
Handle a fatal Python error without traceback.
FatalPythonErrorNoTraceback () Handle a fatal Python error without traceback .
// create caption and message objects // display message box