|
Stylesheets for the error display?: msg#00258web.mason.user
Hi, Recently I've been busy moving all the markup from HTML to CSS in my Mason-based system, and I suddenly realized that the errors that are displayed are full of HTML-based markup (tables, font tags, etc). For my development systems I'm running with: 'error_format' => 'html', 'error_mode' => 'output', And these errors are thus shown "inline", somewhere in the page, meaning that my HTML is suddenly disrupted by HTML such as this: <html><body> <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><b>System error</b></font></p> <table border="0" cellspacing="0" cellpadding="1"> <tr> <td nowrap="nowrap" align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="-2"><b>error:</b> </font></td> <td align="left" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Month '-1' out of range 0..11 at /web/backend-perl/docs/cmos-dev/cosmos/tts/edit.html line 128<br></font></td> Now, of course I'm fully aware that such errors shouldn't appear at all, after all - they're bugs in my code. But the fact is that they are displayed, and they can become quite unreadable at times (depending on the component were the error appears), or simply use up a lot of screenspace. Also, I rarely need the raw error output. But the other information can be quite useful, also for others (to report the error to me). I believe there should be a 'html_css' (or such) error_mode parameter, that doesn't contain all this markup, and contain the right style-classes to let the developer (or author) determine the markup. For example, instead of (from Exceptions.pm): ---------------------------------------------------------------------- <tr> <td align="left" valign="top" nowrap="nowrap"><b>code stack:</b> </td> <td align="left" valign="top" nowrap="nowrap"> % foreach my $frame (@{$info->{frames}}) { <% $frame->filename |h %>:<% $frame->line |h %><br> % } </td> </tr> </table> <a href="#raw">raw error</a><br> <br> .... ---------------------------------------------------------------------- Something like: ---------------------------------------------------------------------- <div id="mason-raw-error" class="mason-raw-error"> <div id="mason-codestack-description" class="mason-error-description">code stack:</div> <div id="mason-codestack-error" class="mason-error-data"> % foreach my $frame (@{$info->{frames}}) { <% $frame->filename |h %>:<% $frame->line |h %><br> % } </div> </div> <a class="mason-raw-output-dump" href="#mason-raw-output">raw error</a><br> <div id="mason-raw-spacer" class="mason-raw-spacer"> <br /> </div> % my $raw = $error->raw_text; % HTML::Mason::Escapes::basic_html_escape(\$raw); % $raw =~ s/\t//g; <a id="mason-raw-output" name="mason-raw-output"></a> <div id="mason-raw-output-dump" class="mason-raw-output-dump"> <% $raw |h %> </div> ---------------------------------------------------------------------- Then, authors could simply add the required styles to their stylesheets to totally hide some or more blocks from the error output, or to set other styles to make it friendlier to those who have to be able to read the errors: #mason-raw-output-dump { display: none; } #mason-raw-spacer { display: none; } .mason_error_description { font-weight: bold; } A sample stylesheet could of course provide defaults equivalent to the error_mode => 'html', as a starting point. Even crazier stuff should be possible too, when using a decent browser with *proper* CSS support (which excludes Internet Exploder, mostly): #mason-error { position: fixed; top: 110px; left: 150px; background: #eee; border: 1px solid black; } And that would put the error right there, floating in a fixed position on your screen. Or anywhere else you'd like. A 'html_css' mode might save others the effort of having to add their own exception-method, just to have a different layout for the errors. It's what CSS is made for anyway ... but I don't know how well browsers will cope with the disrupted structure of the document (after all, the error can occur somewhere in the middle of your page). My own CSS still seems to apply well anyway after an error. Good idea? Bad idea? I suppose I could provide a patch some time, but I'd have to make it first. :) Grtz, Pascal ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Accessing %ARGS: 00258, Drew Johnston |
|---|---|
| Next by Date: | Re: subroutines: 00258, Dave Rolsky |
| Previous by Thread: | subroutinesi: 00258, Drew Johnston |
| Next by Thread: | Re: Stylesheets for the error display?: 00258, Jonathan Swartz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |