MCPcopy Create free account
hub / github.com/creatale/node-dv / error

Method error

deps/tesseract/ccutil/errcode.cpp:40–91  ·  view source on GitHub ↗

* error * * Print an error message and continue, exit or abort according to action. * Makes use of error messages and numbers in a common place. * **********************************************************************/

Source from the content-addressed store, hash-verified

38 *
39 **********************************************************************/
40void ERRCODE::error( // handle error
41const char *caller, // name of caller
42TessErrorLogCode action, // action to take
43const char *format, ... // special message
44) const {
45 va_list args; // variable args
46 char msg[MAX_MSG];
47 char *msgptr = msg;
48
49 if (caller != NULL)
50 //name of caller
51 msgptr += sprintf (msgptr, "%s:", caller);
52 //actual message
53 msgptr += sprintf (msgptr, "Error:%s", message);
54 if (format != NULL) {
55 msgptr += sprintf (msgptr, ":");
56 va_start(args, format); //variable list
57 #ifdef _WIN32
58 //print remainder
59 msgptr += _vsnprintf (msgptr, MAX_MSG - 2 - (msgptr - msg), format, args);
60 msg[MAX_MSG - 2] = '\0'; //ensure termination
61 strcat (msg, "\n");
62 #else
63 //print remainder
64 msgptr += vsprintf (msgptr, format, args);
65 //no specific
66 msgptr += sprintf (msgptr, "\n");
67 #endif
68 va_end(args);
69 }
70 else
71 //no specific
72 msgptr += sprintf (msgptr, "\n");
73
74 // %s is needed here so msg is printed correctly!
75 fprintf(stderr, "%s", msg);
76
77 int* p = NULL;
78 switch (action) {
79 case DBG:
80 case TESSLOG:
81 return; //report only
82 case TESSEXIT:
83 //err_exit();
84 case ABORT:
85 // Create a deliberate segv as the stack trace is more useful that way.
86 if (!*p)
87 abort();
88 default:
89 BADERRACTION.error ("error", ABORT, NULL);
90 }
91}

Callers 15

compute_page_skewFunction · 0.45
delete_non_dropout_rowsFunction · 0.45
compute_row_statsFunction · 0.45
check_path_legalFunction · 0.45
OpenBoxFileFunction · 0.45
removeMethod · 0.45
get_lineMethod · 0.45
assign_to_sublistMethod · 0.45
forwardMethod · 0.45
data_relativeMethod · 0.45
move_to_lastMethod · 0.45
exchangeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected