Update of /cvsroot/hcoop/portal
In directory sc8-pr-cvs17:/tmp/cvs-serv5195

Modified Files:
        exn.mlt init.sig init.sml 
Log Message:
More verbose system error reporting

Index: init.sig
===================================================================
RCS file: /cvsroot/hcoop/portal/init.sig,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** init.sig    25 Feb 2007 21:05:26 -0000      1.11
--- init.sig    11 Sep 2007 10:57:37 -0000      1.12
***************
*** 55,57 ****
--- 55,61 ----
      val nodeName : int -> string
      val nodeDebian : int -> string
+ 
+     val explain : exn -> string
+     val tokens : unit -> string
+     val tokensForked : unit -> unit
  end

Index: init.sml
===================================================================
RCS file: /cvsroot/hcoop/portal/init.sml,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** init.sml    28 May 2007 22:25:57 -0000      1.17
--- init.sml    11 Sep 2007 10:57:37 -0000      1.18
***************
*** 204,206 ****
--- 204,236 ----
        | row => rowError ("nodeDebian", row)
  
+ fun explain e =
+     case e of
+       OS.SysErr (name, sop) =>
+       "System error: " ^ name ^
+       (case sop of
+            NONE => ""
+          | SOME syserr => ": " ^ OS.errorName syserr ^ ": " ^ OS.errorMsg 
syserr)
+       | _ => "Unknown"
+ 
+ fun tokens () =
+     let
+       val proc = Unix.execute ("/usr/bin/tokens", [])
+       val inf = Unix.textInstreamOf proc
+ 
+       fun reader acc =
+           case TextIO.inputLine inf of
+               NONE => String.concat (rev acc)
+             | SOME s => reader (s :: acc)
+     in
+       reader []
+       before (TextIO.closeIn inf;
+               ignore (Unix.reap proc))
+     end
+ 
+ fun tokensForked () =
+     case Posix.Process.fork () of
+       NONE => (OS.Process.system "/usr/bin/tokens >/tmp/tokens.child";
+                OS.Process.exit OS.Process.success)
+       | _ => ignore (OS.Process.system "/usr/bin/tokens >/tmp/tokens.parent")
+ 
  end

Index: exn.mlt
===================================================================
RCS file: /cvsroot/hcoop/portal/exn.mlt,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** exn.mlt     25 Feb 2007 21:05:26 -0000      1.6
--- exn.mlt     11 Sep 2007 10:57:37 -0000      1.7
***************
*** 12,17 ****
  <% | OS.SysErr (name, SOME syserr) => %>
  <b>System error</b>: <% Web.html name %>: <% Web.html (OS.errorName syserr) 
%>: <% Web.htmlNl (OS.errorMsg syserr) %>
! <% | IO.Io {name, function, ...} => %>
! <b>IO error</b>: <% Web.html name %> for <% Web.html function %>
  <% | Init.C.Sql msg => %>
  <b>SQL</b>: <% Web.htmlNl msg %>
--- 12,19 ----
  <% | OS.SysErr (name, SOME syserr) => %>
  <b>System error</b>: <% Web.html name %>: <% Web.html (OS.errorName syserr) 
%>: <% Web.htmlNl (OS.errorMsg syserr) %>
! <% | IO.Io {name, function, cause, ...} => %>
! <b>IO error</b>: <% Web.html name %> for <% Web.html function %><br>
! <b>Cause</b>: <% Web.html (Init.explain cause) %><br>
! <b>Tokens</b>: <p><% Web.htmlNl (Init.tokens ()) %></p>
  <% | Init.C.Sql msg => %>
  <b>SQL</b>: <% Web.htmlNl msg %>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
hcoop-cvs mailing list
hcoop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hcoop-cvs

Reply via email to