MCPcopy Create free account
hub / github.com/davisking/dlib / check_for_previous_fatal_errors

Method check_for_previous_fatal_errors

dlib/error.h:255–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253 }
254
255 void check_for_previous_fatal_errors()
256 {
257 // If dlib is being use to create plugins for some other application, like
258 // MATLAB, then don't do these checks since it terminates the over arching
259 // system. Just let the errors go to the plugin handler and it will deal with
260 // them.
261#if defined(MATLAB_MEX_FILE) || defined(DLIB_NO_ABORT_ON_2ND_FATAL_ERROR)
262 return;
263#else
264 static bool is_first_fatal_error = true;
265 if (is_first_fatal_error == false)
266 {
267 std::cerr << "\n\n ************************** FATAL ERROR DETECTED ************************** " << std::endl;
268 std::cerr << " ************************** FATAL ERROR DETECTED ************************** " << std::endl;
269 std::cerr << " ************************** FATAL ERROR DETECTED ************************** \n" << std::endl;
270 std::cerr << "Two fatal errors have been detected, the first was inappropriately ignored. \n"
271 << "To prevent further fatal errors from being ignored this application will be \n"
272 << "terminated immediately and you should go fix this buggy program.\n\n"
273 << "The error message from this fatal error was:\n" << this->what() << "\n\n" << std::endl;
274 assert(false);
275 abort();
276 }
277 else
278 {
279 // copy the message into the fixed message buffer so that it can be recalled by dlib_fatal_error_terminate
280 // if needed.
281 char* msg = message();
282 unsigned long i;
283 for (i = 0; i < 2000-1 && i < this->info.size(); ++i)
284 msg[i] = info[i];
285 msg[i] = '\0';
286
287 // set this termination handler so that if the user doesn't catch this dlib::fatal_error that is being
288 // thrown then it will eventually be printed to standard error
289 std::set_terminate(&dlib_fatal_error_terminate);
290 }
291 is_first_fatal_error = false;
292#endif
293 }
294 };
295
296// ----------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

whatMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected