Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 32891)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 32892)
@@ -406,5 +406,5 @@
 
     // If you want to run a Perl command without doing GS2PerlConstructor's custom logging in the build log
-    // The use the runSimplePerlCommand() versions, which use the default behaviour of running a SafeProcess
+    // Then use the runSimplePerlCommand() versions, which use the default behaviour of running a SafeProcess
     protected boolean runSimplePerlCommand(String[] command) {	
 	return runSimplePerlCommand(command, null, null);
@@ -532,9 +532,10 @@
 	    
 	    if (perlProcess.getExitValue() == 0) { //status = OK;
-		
+		//logger.info("@@@@@@@@ runPerlCommand success - exitvalue = " + perlProcess.getExitValue());
 		sendProcessStatus(new ConstructionEvent(this, GSStatus.CONTINUING, "Success"));
 		success = true;
 
 	    } else { //status = ERROR;
+		logger.debug("@@@@@@@@ runPerlCommand failed, exitvalue = " + perlProcess.getExitValue());
 		sendProcessStatus(new ConstructionEvent(this, GSStatus.ERROR, "Failure"));
 		success = false;
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java	(revision 32891)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java	(revision 32892)
@@ -81,5 +81,5 @@
   protected boolean noRecordsMatch = false;
       
-  /** A set of all known 'sets' TODO: set_oaiset as name */
+  /** A set of all known 'sets'. */
   protected HashSet<String> set_oaiset = null;
 
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 32891)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 32892)
@@ -401,4 +401,23 @@
 		String statusString = GSXML.getNodeText(statusElem);
 		statusString += " and monitored until done."; 
+		// check for errors
+		int status_code = Integer.parseInt(statusElem.getAttribute(GSXML.STATUS_ERROR_CODE_ATT));
+		if (GSStatus.isError(status_code)) {
+			logger.info("Got error status code: " + status_code);
+			statusString += "But got error status code: " + status_code;
+		} else { // check for Construction event errors
+			String id = statusElem.getAttribute("pid");
+			GS2PerlListener currentListener = this.listeners.get(id);
+			status_code = currentListener.getStatus();
+			if (GSStatus.isError(status_code))
+			{
+				logger.info("xxxx Got construction event error. Error status code: " + status_code);
+				statusString += "But got construction event error, status code: " + status_code;
+				// add the rest of the messages to the statusElem node
+				statusString += "\n" + currentListener.getUpdate(); 
+				statusElem.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(currentListener.getStatus()));
+			}			
+		}		
+		// can finally set statusString
 		GSXML.setNodeText(statusElem, statusString);
 		
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSStatus.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSStatus.java	(revision 32891)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSStatus.java	(revision 32892)
@@ -24,5 +24,5 @@
     public static final int SUCCESS = 1; // request succeeded
     public static final int ACCEPTED = 2; // request accepted but not completed
-    public static final int ERROR = 3; // error and process stopped
+    public static final int ERROR = 3; // error and process stopped. BEWARE: If you change the value of ERROR, concurrently update the value checked for in documentedit_scripts_util.js::hadErrorResponseOnSave()
 
     // responses for status requests
