MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Error

Function Error

misc/error.cpp:116–169  ·  view source on GitHub ↗

exits the application and prints out a standard error message

Source from the content-addressed store, hash-verified

114
115// exits the application and prints out a standard error message
116void Error(const char *fmt, ...) {
117 std::va_list arglist;
118 int exit_msg_len;
119
120 strcpy(Exit_message, "Error: ");
121
122 va_start(arglist, fmt);
123 exit_msg_len = strlen(Exit_message);
124 std::vsnprintf(Exit_message + exit_msg_len, MAX_MSG_LEN - exit_msg_len, fmt, arglist);
125 va_end(arglist);
126
127 snprintf(Exit_title_str, sizeof(Exit_title_str), "%s Error", App_title);
128 mprintf(0, "%s\n", Exit_message);
129
130#ifdef _DEBUG
131 int answer = IDOK;
132
133 if (DebugBreak_callback_stop)
134 (*DebugBreak_callback_stop)();
135
136 if (Debug_break)
137 answer = Debug_ErrorBox(OSMBOX_ABORTRETRYIGNORE, Exit_title_str, Exit_message, "Press RETRY to debug.");
138 else
139 answer = Debug_ErrorBox(OSMBOX_OKCANCEL, Exit_title_str, Exit_message,
140 "Press OK to exit, CANCEL to ignore this error and continue.");
141
142 switch (answer) {
143 case IDRETRY:
144 debug_break(); // Step Out of this function to see where Error() was called
145 // fall into ignore/cancel case
146 case IDIGNORE:
147 case IDCANCEL:
148 if (DebugBreak_callback_resume)
149 (*DebugBreak_callback_resume)();
150 return;
151 case IDOK:
152 case IDABORT:
153 break; // do nothing, and exit below
154 }
155
156 // Clear the message, since we don't need to see it again when we exit
157 Exit_message[0] = 0;
158
159#else
160 if (!Error_initialized)
161 error_Spew();
162#endif
163
164 // Clear the DEBUG_BREAK() callbacks
165 SetDebugBreakHandlers(NULL, NULL);
166
167 // Leave the program
168 exit(0);
169}
170
171// Brings up an error message for an int3
172void Int3MessageBox(const char *file, int line) {

Callers 15

ddgr_FatalErrorFunction · 0.85
mng_InitPagelocksFunction · 0.85
mng_InitNetTablesFunction · 0.85
mng_BackupTableFileFunction · 0.85
mng_AllocTrackLockFunction · 0.85
mng_ReadDummyPageFunction · 0.85
mng_LoadNetPagesFunction · 0.85
mng_LoadLocalPagesFunction · 0.85
mng_PopAddonPagesFunction · 0.85
mng_PushAddonPageFunction · 0.85

Calls 4

debug_breakFunction · 0.85
error_SpewFunction · 0.85
SetDebugBreakHandlersFunction · 0.85
Debug_ErrorBoxFunction · 0.50

Tested by

no test coverage detected