Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
The current devel error handling options let you choose between the nice backtrace and the standard drupal message area, but I have had situations where I could really have done with both. Some themes do not display the backtrace the same in every situation and depending on what the page is doing it has been very useful to get both. Attached are a couple of screen shots.
I will add the patch too, and you can consider whether you like it. Obviously I will make a D7 patch too, but I was working on a D6 site when I needed this.
Jonathan
Comments
Comment #1
salvisYes, I've made the same experience. Please provide a patch for D7 first.
Comment #2
jonathan1055 CreditAttribution: jonathan1055 commentedHere is the patch for D7 as requested, against the dev of 8th April. There are 3 chunks in .module and 1 in .admin.inc
Jonathan
Comment #3
salvisPlease don't name it _d7, because that keeps the testbot from picking it up...
Comment #4
jonathan1055 CreditAttribution: jonathan1055 commentedSorry. I thought that _d7 was ok and it was -d7 which avoided the test bot. My mistake.
Comment #5
salvis$type[1] is the error level (E_WARNING for example, which is 4), not the drupal_set_message() type ('warning' in this case).
Please spell "Drupal" with a capital "D" (and correct the other option, too).
Comment #6
jonathan1055 CreditAttribution: jonathan1055 commentedYes, sure. Both messages now have capital D, and $type[1] replaced with 'error' as it is a real error condition not just a warning. I should have checked that.
Comment #7
salvisDepending on the error_level() there could be warnings or notices, too. I'm sure someone will complain if we display these in bright red...
($type[1] <= WATCHDOG_ERROR ? 'error' : 'warning')
should do the trick (untested!).
Comment #8
jonathan1055 CreditAttribution: jonathan1055 commentedI realised that what we actually need is a conversion from the error_level to the drupal_set_message status value, so that the correct status and styling are used. I've added that into this patch, using a simple array
The actual values can be changed, this was just my initial mapping.
Comment #9
salvisYes, that would be the ultimate perfect solution, but it's too involved for this little feature, IMO. I think we'll be fine with WATCHDOG_DEBUG formatted as 'warning' (just not as 'error').
Comment #10
jonathan1055 CreditAttribution: jonathan1055 commentedSorry, I seem to have forgotten about this. Yes, take your point about being too involved. Here is a patch with your simpler translation. Patched against dev of 28th Sept.
Comment #12
salvisPushed to D8 and D7, thanks!
Please reopen if you want to post a patch for D6, too.
Comment #13
salvisHmm, that's funny! Until a few minutes ago, #10 was yellow (waiting), and now that I've pushed the patch (with a few minor tweaks), it just turned red.
Obviously, the patch cannot be applied a second time, but the timing is surprising...
Comment #14
jonathan1055 CreditAttribution: jonathan1055 commentedFrom the error:
Yes I made the patch with
diff -up
and I tested it by usingpatch -b -p0
There is obviously a better way I should be using, so that it is consistent with the new testbots. I'll have a look round to see if I can find it, unless you can tell me here ;-)
Yes I will do a D6 patch too.
Comment #15
salvisI'm not up to speed with the subtleties of patching, I just use
git diff
and never had a problem.I didn't have any problem applying your patch with
git apply
either, for that matter.Comment #16
jonathan1055 CreditAttribution: jonathan1055 commentedHere is the patch ported for D6, created against the 1.26 dev dated 13th Sept 2011.
There are many developers still working on existing D6 sites, so I hope you can commit this. Thanks
Jonathan
Comment #18
jonathan1055 CreditAttribution: jonathan1055 commentedMy patch failed to apply because the testbots do not accept p0 style patches any more, they only accept p1 style, as I found out via http://groups.drupal.org/node/140204
I do not have git installed, so does anyone know how I can make the required patches using diff?
Jonathan
Comment #19
jonathan1055 CreditAttribution: jonathan1055 commentedManually editted patch file, just to see if this gets applied ok.
Comment #20
salvisPushed to the -dev version, thanks!
Comment #21
jonathan1055 CreditAttribution: jonathan1055 commentedThank you.