Monday, November 08, 2010 at 12:06 AM.

system.verbs.builtins.webserver.errorMessage

on errorMessage (errMsg, dataAdr = nil) {
	try {
		<<PBS 2/8/97: call string.iso8859encode rather than toys.cleanForExport
		errMsg = string.iso8859encode (errMsg, @html.data.iso8859.mac);
		bundle { <<log error
			local {
				fPath = file.folderFromPath (Frontier.getProgramPath ()) + "Error.log";
				logString = string.replace (clock.now (), "; ", tab) + tab + errMsg};
			if !file.exists (fPath) { <<create file with field name in first line
				file.new (fPath);
				file.setType (fPath, 'TEXT');
				file.setCreator (fPath, 'R*ch')};
			semaphores.lock ("error.log", 3600);
			try {
				file.writeLine (fPath, logString);
				if (dataAdr != nil) and (defined (dataAdr)) and (webserver.getPref ("verboseLogging")) { <<verbose logging -- still testing
					local (i);
					for i = 1 to sizeOf (dataAdr^) {
						file.writeLine (fPath, nameOf (dataAdr^[i]) + ": " + dataAdr^[i])}};
				semaphores.unlock ("error.log")}
			else {
				semaphores.unlock ("error.log")}};
		local (x);
		if typeOf (dataAdr) != addressType { <<create an address to a table
			new (tableType, @x);
			dataAdr = @x};
		dataAdr^.errorMessage = errMsg;
		local (htmltext = webserver.httpHeader (), errPage = string (webserver.getPref ("errorPage")));
		htmltext = htmltext + webserver.processMacros (errPage, dataAdr);
		return (htmltext)}
	else {
		return ("An unknown error occurred in Frontier.")}}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.