| 52 | // Save the error info in our global string err_g. |
| 53 | |
| 54 | static int CV_CDECL CvErrorCallbackForStasm( |
| 55 | int code, // translated to a string e.g. "Assertion failed" |
| 56 | const char* , // unused here |
| 57 | const char* err_msg, // e.g. the contents of the line where assert failed |
| 58 | const char* file_name, // filename where error occurred (if available) |
| 59 | int line, // line number where error occurred |
| 60 | void* ) // unused here |
| 61 | { |
| 62 | if (err_g[0]) |
| 63 | { |
| 64 | // Recursive, we are already processing an error. |
| 65 | // Not really an issue, only first error will be reported via LastErr. |
| 66 | printf("\nNested error in CvErrorCallbackForStasm\n" |
| 67 | " Current error: %.80s\n New error: %s:%d: %.80s\n", |
| 68 | err_g, |
| 69 | file_name && file_name[0]? file_name: "unknown file", line, err_msg); |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | char temp[SBIG]; // temporary string needed because err_msg may be err_g |
| 74 | const char* errmsg = cvErrorStr(code); |
| 75 | if (file_name && file_name[0]) |
| 76 | sprintf(temp, "%s(%d) : %s : %s", |
| 77 | BaseExt(file_name), line, errmsg, err_msg); |
| 78 | else |
| 79 | sprintf(temp, "OpenCV %s : %s", errmsg, err_msg); |
| 80 | |
| 81 | STRCPY(err_g, temp); |
| 82 | } |
| 83 | PossiblyEnterDebugger(); |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | void CatchOpenCvErrs(void) // makes CV_Assert work with LastErr and stasm_lasterr |
| 88 | { |
nothing calls this directly
no test coverage detected