Download & Extend

New error handling option: Backtrace and normal message

Project:Devel
Version:6.x-1.x-dev
Component:devel
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

AttachmentSizeStatusTest resultOperations
new error option - admin page.jpg89.3 KBIgnored: Check issue status.NoneNone
new error option - example.jpg505.73 KBIgnored: Check issue status.NoneNone

Comments

#1

Yes, I've made the same experience. Please provide a patch for D7 first.

#2

Version:6.x-1.24» 7.x-1.x-dev

Here 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

AttachmentSizeStatusTest resultOperations
_1163356_2.devel_.error_handler_option_d7.patch1.83 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch _1163356_2.devel_.error_handler_option_d7.patch. Unable to apply patch. See the log in the details link for more information.View details

#3

Status:active» needs review

Please don't name it _d7, because that keeps the testbot from picking it up...

#4

Sorry. I thought that _d7 was ok and it was -d7 which avoided the test bot. My mistake.

AttachmentSizeStatusTest resultOperations
_1163356_4.devel_.error_handler_option.patch1.83 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#5

Status:needs review» needs work

+++ devel.module 2011-05-21 10:33:41.000000000 +0100
@@ -634,6 +636,11 @@ function backtrace_error_handler($error_
+        drupal_set_message(t('%error: %message in %function (line %line of %file).', $variables), $type[1]);

$type[1] is the error level (E_WARNING for example, which is 4), not the drupal_set_message() type ('warning' in this case).

+++ devel.admin.inc 2011-05-21 09:25:48.000000000 +0100
@@ -113,6 +113,7 @@ function devel_admin_settings() {
+    $form['devel_error_handler']['#options'][DEVEL_ERROR_HANDLER_BACKTRACE_AND_MESSAGE] = t('Backtrace plus standard drupal message');

Please spell "Drupal" with a capital "D" (and correct the other option, too).

#6

Status:needs work» needs review

Yes, 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.

AttachmentSizeStatusTest resultOperations
_1163356_6.devel_.error_handler_option.patch2.7 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#7

Depending 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!).

#8

I 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

<?php
$message_status
= array(WATCHDOG_ERROR => 'error',
                       
WATCHDOG_WARNING => 'warning',
                       
WATCHDOG_NOTICE => 'warning',
                       
WATCHDOG_DEBUG => 'status');
?>

The actual values can be changed, this was just my initial mapping.
AttachmentSizeStatusTest resultOperations
_1163356_8.devel_.error_handler_option.patch3.07 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#9

Yes, 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').

#10

Sorry, 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.

AttachmentSizeStatusTest resultOperations
_1163356_10.devel_.error_handler_option.patch3.51 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch _1163356_10.devel_.error_handler_option.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#11

Status:needs review» needs work

The last submitted patch, _1163356_10.devel_.error_handler_option.patch, failed testing.

#12

Status:needs work» fixed

Pushed to D8 and D7, thanks!

Please reopen if you want to post a patch for D6, too.

#13

Hmm, 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...

#14

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:fixed» patch (to be ported)

From the error:

This may be a -p0 (old style) patch, which is no longer supported by the testbots.

Yes I made the patch with diff -up and I tested it by using patch -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.

#15

I'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.

#16

Status:patch (to be ported)» needs review

Here 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

AttachmentSizeStatusTest resultOperations
_1163356_16.devel_.error_handler_option.patch3.39 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch _1163356_16.devel_.error_handler_option.patch. Unable to apply patch. See the log in the details link for more information.View details

#17

Status:needs review» needs work

The last submitted patch, _1163356_16.devel_.error_handler_option.patch, failed testing.

#18

My 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

#19

Status:needs work» needs review

Manually editted patch file, just to see if this gets applied ok.

AttachmentSizeStatusTest resultOperations
_1163356_19.devel_.error_handler_option.patch3.37 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#20

Status:needs review» fixed

Pushed to the -dev version, thanks!

#21

Thank you.

#22

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here