summaryrefslogtreecommitdiff
path: root/ext/mro
diff options
context:
space:
mode:
authorFlorian Ragwitz <rafl@debian.org>2009-03-28 11:10:08 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-28 12:30:28 +0100
commitb11720532d118951e85d8a680330b826a6ab4227 (patch)
treed4735b11e79aeaa873ab3ef67342338d6e5f50aa /ext/mro
parentd21dfdd8f25c3ecd360f3295c2fbefd28c0d372a (diff)
downloadperl-b11720532d118951e85d8a680330b826a6ab4227.tar.gz
Improve mro merging error messages.
This makes them very similar to those produced by Algorithm::C3.
Diffstat (limited to 'ext/mro')
-rw-r--r--ext/mro/mro.xs14
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs
index 3d343d4830..1208c6ca05 100644
--- a/ext/mro/mro.xs
+++ b/ext/mro/mro.xs
@@ -202,13 +202,23 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level)
/* If we had candidates, but nobody won, then the @ISA
hierarchy is not C3-incompatible */
if(!winner) {
+ SV *errmsg;
+ I32 i;
+
+ errmsg = newSVpvf("Inconsistent hierarchy during C3 merge of class '%s':\n\t"
+ "current merge results [\n", HEK_KEY(stashhek));
+ for (i = 0; i <= av_len(retval); i++) {
+ SV **elem = av_fetch(retval, i, 0);
+ sv_catpvf(errmsg, "\t\t%"SVf",\n", SVfARG(*elem));
+ }
+ sv_catpvf(errmsg, "\t]\n\tmerging failed on '%"SVf"'", SVfARG(cand));
+
/* we have to do some cleanup before we croak */
SvREFCNT_dec(retval);
Safefree(heads);
- Perl_croak(aTHX_ "Inconsistent hierarchy during C3 merge of class '%s': "
- "merging failed on parent '%"SVf"'", HEK_KEY(stashhek), SVfARG(cand));
+ Perl_croak(aTHX_ "%"SVf, SVfARG(errmsg));
}
}
}