pg: More verbose error traces
Partly because some errors currently appeared to come from within FU::PG itself, which is useless, and partly because it's common to wrap database access methods, while that's exactly the kind of operation where you *really* want to know where the error originated from. (Source: too much time wasted debugging VNDB errors)
This commit is contained in:
parent
96aee880ce
commit
7c8473533d
4 changed files with 46 additions and 27 deletions
23
c/common.c
23
c/common.c
|
|
@ -26,7 +26,7 @@ static SV *fu_croak_hv(HV *hv, const char *klass, const char *message, ...) {
|
|||
ENTER;
|
||||
SAVETMPS;
|
||||
PUSHMARK(SP);
|
||||
XPUSHs(sv_2mortal(sv));
|
||||
mXPUSHs(sv);
|
||||
PUTBACK;
|
||||
call_pv("Carp::longmess", G_SCALAR);
|
||||
hv_stores(hv, "full_message", SvREFCNT_inc(POPs));
|
||||
|
|
@ -36,6 +36,27 @@ static SV *fu_croak_hv(HV *hv, const char *klass, const char *message, ...) {
|
|||
return sv_bless(sv_2mortal(newRV_noinc((SV *)hv)), gv_stashpv(klass, GV_ADD));
|
||||
}
|
||||
|
||||
__attribute__((noreturn, format (printf, 1, 2)))
|
||||
static void fu_confess(const char *message, ...) {
|
||||
va_list args;
|
||||
SV *sv;
|
||||
dTHX;
|
||||
dSP;
|
||||
|
||||
va_start(args, message);
|
||||
sv = vnewSVpvf(message, &args);
|
||||
va_end(args);
|
||||
|
||||
ENTER;
|
||||
SAVETMPS;
|
||||
PUSHMARK(SP);
|
||||
mXPUSHs(sv);
|
||||
PUTBACK;
|
||||
call_pv("Carp::confess", G_DISCARD);
|
||||
/* Won't happen, but a safe fallback */
|
||||
croak("%s", SvPV_nolen(sv));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Custom string builder, should be slightly faster than using Sv* macros directly. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue