Changeset 1929 for trunk/gui/scripts/bugreport.tcl
- Timestamp:
- Oct 22, 2010, 4:06:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/bugreport.tcl
r1912 r1929 73 73 if {"@SHOWDETAILS" == $err} { 74 74 pack propagate .bugreport yes 75 76 77 75 pack forget .bugreport.expl 76 pack forget .bugreport.xmit 77 pack forget .bugreport.done 78 78 pack forget .bugreport.cntls.show 79 80 81 82 83 79 pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x 80 pack .bugreport.details -after .bugreport.banner \ 81 -expand yes -fill both -padx 8 -pady 8 82 pack .bugreport.comments -after .bugreport.details \ 83 -expand yes -fill both -padx 8 -pady {0 8} 84 84 85 85 update idletasks … … 93 93 wm geometry .bugreport $x$y 94 94 raise .bugreport 95 95 return 96 96 } 97 97 … … 119 119 .bugreport.expl insert end "Something went wrong with this tool. Help us understand what happened by submitting a trouble report, so we can fix the problem. If you continue having trouble with this tool, please close it and restart." 120 120 .bugreport.cntls.send configure -state normal 121 121 focus .bugreport.cntls.send 122 122 } else { 123 123 .bugreport.expl insert end "Something went wrong with this tool. We would ask you to submit a trouble report about the error, but we can't tell what hub it should be submitted to. If you continue having trouble with this tool, please close it and restart." 124 124 pack forget .bugreport.comments 125 125 .bugreport.cntls.send configure -state disabled 126 126 focus .bugreport.cntls.ok 127 127 } 128 128 fixTextHeight .bugreport.expl … … 294 294 # handle the result 295 295 if {$status != 0} { 296 297 298 299 300 301 296 # add error to the details field, so we can see it with magic clicks 297 .bugreport.details.info.text configure -state normal 298 .bugreport.details.info.text insert 1.0 "Ticket submission failed:\n$result\n-----\n" 299 .bugreport.details.info.text configure -state disabled 300 301 .bugreport.expl insert end "Oops! Ticket submission failed:\n$result\n\nIf you want to report the original problem, you can file your own trouble report by going to the web site and clicking on the \"Help\" or \"Support\" link on the main navigation bar. If you continue having trouble with this tool, please close it and restart." 302 302 } elseif {[regexp {Ticket #([0-9]*) +\((.*?)\) +([0-9]+) +times} $result match ticket extra times]} { 303 304 305 306 307 303 .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." "" 304 if {[string is integer $times] && $times > 1} { 305 .bugreport.expl insert end " This particular problem has been reported $times times." 306 } 307 .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and restart. Thanks for reporting the problem and helping us improve things!" 308 308 } else { 309 309 .bugreport.expl insert end "This problem has been reported. Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and restart. Thanks for reporting the problem and helping us improve things!" "" 310 310 } 311 311 fixTextHeight .bugreport.expl … … 335 335 set stackTrace "$err\n---------\n$errorInfo\n---------\n$extraInfo" 336 336 if {![regexp {^([^\n]+)\n} $stackTrace match summary]} { 337 338 339 340 341 337 if {[string length $stackTrace] == 0} { 338 set summary "Unexpected error from Rappture" 339 } else { 340 set summary $stackTrace 341 } 342 342 } 343 343 if {[string length $summary] > 200} { 344 344 set summary "[string range $summary 0 200]..." 345 345 } 346 346 if {[string match {Problem launching job*} $summary]} { 347 348 347 append summary " (in tool \"[Rappture::Tool::resources -appname]\")" 348 set category "Tools" 349 349 } else { 350 350 set category $settings(category) 351 351 } 352 352 … … 354 354 set toolong 20000 355 355 if {[string length $stackTrace] > $toolong} { 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 356 # 357 # If this came from "Problem launching job", then it will have 358 # a "== RAPPTURE INPUT ==" part somewhere in the middle. Try 359 # to show the first part, this middle part, and the very last 360 # part, cutting out whatever we have to in the middle. 361 # 362 if {[regexp -indices {\n== RAPPTURE INPUT ==\n} $stackTrace match]} { 363 foreach {smid0 smid1} $match break 364 set quarter [expr {$toolong/4}] 365 set s0 $quarter 366 set smid0 [expr {$smid0-$quarter}] 367 set smid1 [expr {$smid1+$quarter}] 368 set s1 [expr {[string length $stackTrace]-$quarter}] 369 370 if {$smid0 < $s0} { 371 # first part is short -- truncate last part 372 set stackTrace "[string range $stackTrace 0 $smid1]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-($toolong-$smid1)}] end]" 373 } elseif {$smid1 > $s1} { 374 # last part is short -- truncate first part 375 set tailsize [expr {[string length $stackTrace]-$smid0}] 376 set stackTrace "[string range $stackTrace 0 [expr {$toolong-$tailsize}]]\n...\n[string range $stackTrace $smid0 end]" 377 } else { 378 # rappture input line is right about in the middle 379 set stackTrace "[string range $stackTrace 0 $s0]\n...\n[string range $stackTrace $smid0 $smid1]\n...\n[string range $stackTrace $s1 end]" 380 } 381 } else { 382 # no Rappture input -- just show first part and last part 383 set half [expr {$toolong/2}] 384 set stackTrace "[string range $stackTrace 0 $half]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-$half}] end]" 385 } 386 386 } 387 387 … … 419 419 420 420 set query [http::formatQuery \ 421 422 423 424 425 426 427 428 429 430 431 432 433 421 option com_support \ 422 task create \ 423 no_html 1 \ 424 report $report \ 425 sesstoken $details(session) \ 426 hostname $details(hostname) \ 427 os $details(platform) \ 428 category $details(category) \ 429 summary $details(summary) \ 430 referrer $details(referrer) \ 431 login $settings(user) \ 432 group $settings(group) \ 433 type $settings(type) \ 434 434 ] 435 435 436 436 set url [Rappture::Tool::resources -huburl] 437 437 if {[string index $url end] == "/"} { 438 438 append url "index.php" 439 439 } else { 440 440 append url "/index.php" 441 441 } 442 442 … … 444 444 445 445 if {[http::ncode $token] != 200} { 446 446 error [http::code $token] 447 447 } 448 448 upvar #0 $token rval … … 451 451 452 452 if {[regexp {Ticket #[0-9]* +\(.*?\) +[0-9]+ +times} $info match]} { 453 453 return $match 454 454 } 455 455 error "Report received, but ticket may not have been filed. Here's the result...\n$info" … … 472 472 } else { 473 473 for {set h 1} {$h < 15} {incr h} { 474 475 476 477 478 479 474 $widget configure -height $h 475 $widget see 1.0 476 update idletasks 477 if {"" != [$widget bbox end-1char]} { 478 break 479 } 480 480 } 481 481 } … … 497 497 498 498 switch -- $option { 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 499 jobfailures { 500 variable reportJobFailures 501 if {![string is boolean $value]} { 502 error "bad value \"$value\": should be boolean" 503 } 504 set reportJobFailures $value 505 } 506 for { 507 # is it being run within a workspace? 508 set appname [Rappture::Tool::resources -appname] 509 if {[string match {[Ww]orkspace*} $appname]} { 510 return 0 511 } 512 513 # if this is a problem launching a job and the tool 514 # expects this, then don't bother with automatic reports. 515 variable reportJobFailures 516 if {"jobs" == $value && !$reportJobFailures} { 517 return 0 518 } 519 520 # this is a real problem -- report it! 521 return 1 522 } 523 default { 524 error "bad option \"$option\": should be jobfailures or for" 525 } 526 526 } 527 527 }
Note: See TracChangeset
for help on using the changeset viewer.