void ajErr(const char *format, ...) { const char *prefix = ERROR_PREFIX; const char *mesg_buf = NULL; va_list args; ++errorCount; if(AjErrorLevel.error) { AJAXFORMATSTRING(args, format, mesg_buf, prefix); messDump(mesg_buf); if(errorRoutine) (*errorRoutine)(mesg_buf); else fprintf(stderr, "%s\n", mesg_buf); ajMessInvokeDebugger(); ajUtilCatch(); } return; }
__noreturn void ajExceptRaise(const T* e, const char* file, ajint line) { Except_Frame *p; p = Except_stack; assert(e); if(p == NULL) { ajMessOut("Uncaught exception: "); if(e->reason) ajMessOut(" %s,", e->reason); else ajMessOut(" at 0x%p,", e); if(file && line > 0) ajMessOut(" raised at %s:%d\n", file, line); ajUtilCatch(); exit(EXIT_FAILURE); } p->exception = e; p->file = file; p->line = line; Except_stack = Except_stack->prev; longjmp(p->env, Except_raised); }
void ajMessSetErr(const char *filename, ajint line_num) { assert(filename != NULL && line_num != 0); /* ** We take the basename here because __FILE__ can be a path rather ** than just a filename, depending on how a module was compiled. */ messageG.filename = ajSysFuncStrdup(messGetFilename(filename)); messageG.line_num = line_num; ajUtilCatch(); return; }