[phaux commit] r114 - in trunk: Classes/Base Classes/Phaux-test HtmlRoot/scripts-standard

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 4, 2007, 10:10:57 PM10/4/07
to phau...@googlegroups.com
Author: WHarford
Date: Thu Oct 4 19:09:52 2007
New Revision: 114

Modified:
trunk/Classes/Base/WHException.php
trunk/Classes/Phaux-test/WHExceptionTest.php
trunk/HtmlRoot/scripts-standard/standardScript.js

Log:
Show exceptions in a live update callback

Modified: trunk/Classes/Base/WHException.php
==============================================================================
--- trunk/Classes/Base/WHException.php (original)
+++ trunk/Classes/Base/WHException.php Thu Oct 4 19:09:52 2007
@@ -79,7 +79,8 @@
$return .= self::niceFromTracePoint($point,TRUE);

}
- return substr($return,0,1000000);
+ return '<html><head><title>500 Uncaught Exception</title></head>
+ <body>'.substr($return,0,1000000).'</body></html>';

}

Modified: trunk/Classes/Phaux-test/WHExceptionTest.php
==============================================================================
--- trunk/Classes/Phaux-test/WHExceptionTest.php (original)
+++ trunk/Classes/Phaux-test/WHExceptionTest.php Thu Oct 4 19:09:52 2007
@@ -25,7 +25,8 @@
$this->foobar();
}
public function renderContentOn($html){
- return
$html->anchor()->callback($this,"throwException")->with("Throw Exception").
+ return $html->div()->id('whexceptiontest')->with(
+ $html->anchor()->callback($this,"throwException")->with("Throw Exception").
$html->br().
$html->anchor()->callback($this,"triggerError")->with("Trigger Error").
$html->br().
@@ -42,7 +43,13 @@
->with("Include Error").
$html->br().
$html->anchor()->callback($this,"undefinedMethod")
- ->with("Undefined method");
+ ->with("Undefined method").
+ $html->br().
+ $html->anchor()->callback($this,'thorwException')->
+ liveUpdateOn("onClick",$this,'renderContentOn')->
+ with('Live Exception Test')
+ );
+
}

Modified: trunk/HtmlRoot/scripts-standard/standardScript.js
==============================================================================
--- trunk/HtmlRoot/scripts-standard/standardScript.js (original)
+++ trunk/HtmlRoot/scripts-standard/standardScript.js Thu Oct 4
19:09:52 2007
@@ -155,6 +155,12 @@
** Leaving the functionality in for future reference
*/

+ /*
+ ** If we get an html tag we can expect that it is unexpected
+ ** and most likely an error. Replace the contents of the
+ ** entire page
+ */
+
if (child.tagName == "dom") {
var elementId = child.getAttribute("id");
var element = document.getElementById(elementId);
@@ -195,12 +201,11 @@
function xmlProcessResults(response) {

for(i=0; i < response.documentElement.childNodes.length; i++) {
-
+
var child = response.documentElement.childNodes[i];
xmlLiveProcessOne(child);

}
-
}


@@ -211,7 +216,7 @@
** The &amp; s
*/
uri = uri.replace("&amp;","&");
-
+
return xmlLiveUpdater(
function() { return uri; }, xmlProcessResults);

@@ -228,12 +233,12 @@
request = new XMLHttpRequest();
}

+
update();
function update()
{

if(request && request.readyState < 4)
-
request.abort();


@@ -258,7 +263,7 @@
if(request.readyState == 4) {

window.status = "Getting new instructions...";
-
+
if(request && request.responseXML &&
request.responseXML.documentElement) {

processResultsFunc(request.responseXML);
@@ -266,8 +271,14 @@
window.status = "Done";

} else {
+ /*
+ **If we are here assume we reseived an error
+ ** and we should replace the entire contents of
+ ** the page with the responce
+ */

- document.location.reload();
+ document.documentElement.innerHTML = request.responseText;
+ //document.location.reload();

}

Reply all
Reply to author
Forward
0 new messages