void pdc_set_warnmsg( pdc_core * pdc, int errnum, const char *parm1, const char *parm2, const char *parm3, const char *parm4) { char errbuf[PDC_ERRBUF_SIZE]; strcpy(errbuf, pdc->pr->errbuf); if (errnum != -1) { const pdc_error_info *ei = get_error_info(pdc, errnum); make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false); } pdc_logg_cond(pdc, 1, trc_warning, "\n[Warning message %d: \"%s\"]\n", errnum, pdc->pr->errbuf); strcpy(pdc->pr->errbuf, errbuf); } /* pdc_set_warnmsg */
void pdc_push_errmsg( pdc_core * pdc, int errnum, const char *parm1, const char *parm2, const char *parm3, const char *parm4) { static const char fn[] = "pdc_push_errmsg"; const pdc_error_info *ei = get_error_info(pdc, errnum); pdc_pop_errmsg(pdc); make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false); pdc->pr->premsg = pdc_strdup_ext(pdc, pdc->pr->errbuf, 0, fn); } /* pdc_push_errmsg */
void pdc_set_errmsg( pdc_core * pdc, int errnum, const char *parm1, const char *parm2, const char *parm3, const char *parm4) { const pdc_error_info *ei = get_error_info(pdc, errnum); make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false); pdc->pr->errnum = errnum; pdc_logg_cond(pdc, 2, trc_warning, "[Reason for error message %d: \"%s\"]\n", pdc->pr->errnum, pdc->pr->errbuf); } /* pdc_set_errmsg */
void pdc_error( pdc_core * pdc, int errnum, const char *parm1, const char *parm2, const char *parm3, const char *parm4) { const char *logmsg = NULL; /* avoid recursive errors, but allow rethrow. */ if (errnum != -1 && pdc->pr->in_error) return; pdc->pr->in_error = pdc_true; pdc->pr->x_thrown = pdc_true; if (errnum != -1) { const pdc_error_info *ei = get_error_info(pdc, errnum); make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_true); pdc->pr->errnum = errnum; } if (pdc->pr->x_sp > pdc->pr->x_sp0) { if (pdc_logg_is_enabled(pdc, 2, trc_warning)) logmsg = "[Nested exception %d in %s]"; } else { logmsg = "\n[Last exception %d in %s]"; } if (logmsg != NULL) { pdc_logg(pdc, logmsg, pdc->pr->errnum, (pdc->pr->errnum == 0 || !pdc->pr->apiname) ? "" : pdc->pr->apiname, pdc->pr->x_sp0 + 1, pdc->pr->x_sp - pdc->pr->x_sp0); pdc_logg(pdc, "[\"%s\"]\n\n", pdc->pr->errbuf); } if (pdc->pr->x_sp == -1) { char errbuf[PDC_ERRBUF_SIZE]; const char *apiname = pdc_get_apiname(pdc); const char *errmsg = pdc->pr->errbuf; if (strlen(apiname)) { sprintf(errbuf, "[%d] %s: %s", pdc->pr->errnum, apiname, errmsg); errmsg = errbuf; } (*pdc->pr->errorhandler)(pdc->pr->opaque, PDF_UnknownError, errmsg); /* * The error handler must never return. If it does, it is severely * broken. We cannot remedy this, so we exit. */ exit(99); } else { longjmp(pdc->pr->x_stack[pdc->pr->x_sp].jbuf.jbuf, 1); } } /* pdc_error */