Changeset 34173 in webkit


Ignore:
Timestamp:
May 28, 2008 8:46:18 AM (16 years ago)
Author:
Adam Roben
Message:

Print exceptions from PrettyPatch to stdout

This will make it much easier to debug problems with PrettyPatch,
since we'll be able to see the exceptions in the browser.

Reviewed by Sam Weinig.

  • PrettyPatch/prettify.rb: Added a --html-exceptions option, which will print exceptions to stdout as HTML.
  • attachment.cgi: Changed to pass --html-exceptions to prettify.rb.
Location:
trunk/BugsSite
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BugsSite/ChangeLog

    r32601 r34173  
     12008-05-28  Adam Roben  <aroben@apple.com>
     2
     3        Print exceptions from PrettyPatch to stdout
     4
     5        This will make it much easier to debug problems with PrettyPatch,
     6        since we'll be able to see the exceptions in the browser.
     7
     8        Reviewed by Sam Weinig.
     9
     10        * PrettyPatch/prettify.rb: Added a --html-exceptions option, which
     11        will print exceptions to stdout as HTML.
     12        * attachment.cgi: Changed to pass --html-exceptions to prettify.rb.
     13
    1142008-04-26  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/BugsSite/PrettyPatch/prettify.rb

    r30048 r34173  
    22
    33require 'PrettyPatch'
     4require 'optparse'
     5require 'webrick/htmlutils'
     6
     7BACKTRACE_SEPARATOR = "\n\tfrom "
     8
     9options = { :html_exceptions => false }
     10OptionParser.new do |opts|
     11    opts.banner = "Usage: #{File.basename($0)} [options] [patch-file]"
     12
     13    opts.separator ""
     14
     15    opts.on("--html-exceptions", "Print exceptions to stdout as HTML") { |h| options[:html_exceptions] = h }
     16end.parse!
    417
    518patch_data = nil
     
    1023end
    1124
    12 puts PrettyPatch.prettify(patch_data)
     25begin
     26    puts PrettyPatch.prettify(patch_data)
     27rescue => exception
     28    raise unless options[:html_exceptions]
     29
     30    backtrace = exception.backtrace
     31    backtrace[0] += ": " + exception + " (" + exception.class.to_s + ")"
     32    print "<pre>\n", WEBrick::HTMLUtils::escape(backtrace.join(BACKTRACE_SEPARATOR)), "\n</pre>\n"
     33end
  • trunk/BugsSite/attachment.cgi

    r30048 r34173  
    734734                     -expires => '+3M');
    735735
    736   open2(\*OUT, \*IN, "/usr/bin/ruby", "-I", "PrettyPatch", "PrettyPatch/prettify.rb");
     736  open2(\*OUT, \*IN, "/usr/bin/ruby", "-I", "PrettyPatch", "PrettyPatch/prettify.rb", "--html-exceptions");
    737737  print IN $thedata . "\n";
    738738  close(IN);
Note: See TracChangeset for help on using the changeset viewer.